Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
分类:
其他好文 时间:
2014-07-10 00:18:17
阅读次数:
278
原始版本:templatevoid swap(T& a, T& b){ T tmp(a); a = b; b = tmp;}此版本不重视效率,当交换的两个对象比较大时,需要更高效的交换,因此应该提供1)public swap成员函数,让它高效的置换两个对象,并提供nono-memb...
分类:
其他好文 时间:
2014-07-07 19:06:21
阅读次数:
179
请注意:(1)确保当对象自我赋值时operator=有良好行为。其技术包括比较“来源对象”和“目标对象”的地址、精心周到的语句顺序、以及copy-and-swap。(2)确定任何函数如果操作一个以上的对象,而其中多个对象是同一个对象时,其行为仍然正确。
分类:
编程语言 时间:
2014-06-29 20:21:52
阅读次数:
157
Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ...
分类:
其他好文 时间:
2014-06-27 23:13:24
阅读次数:
218
Given a linked list, swap every two adjacent nodes and return its head.
分类:
其他好文 时间:
2014-06-27 12:42:55
阅读次数:
198
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
分类:
其他好文 时间:
2014-06-27 12:25:27
阅读次数:
721
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-06-27 12:21:24
阅读次数:
215
1.查询数据库是否有等待select * from resource_queues where node_name=(select node_name from nodes order by node_name limit 1) order by queue_entry_timestamp desc...
分类:
数据库 时间:
2014-06-27 12:03:53
阅读次数:
680
题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sing...
分类:
其他好文 时间:
2014-06-27 11:38:12
阅读次数:
207
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key....
分类:
其他好文 时间:
2014-06-27 09:15:12
阅读次数:
196