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 ...
分类:
其他好文 时间:
2015-04-26 22:25:53
阅读次数:
201
merge sort 是一种采用分治策略的排序方法。其最坏时间复杂度为 O(nlgn) (对数以2为底)可以先列出递归式,然后画递归树来证明. 也可以用master theorem (主定理)来证明.总之,最关键的就是要列出分治过程中的递归式merge sort的递归式为:C++ 代码如下所示:/*...
分类:
其他好文 时间:
2015-04-26 21:08:00
阅读次数:
171
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.两个已经排序的链表...
分类:
其他好文 时间:
2015-04-26 18:16:04
阅读次数:
111
一、vector和list
线性结构中,比较重要的有 vector和list,这两个都是C++的标准模板库(C++ Standard Template Library)中的库文件。
访问操作,查找和删除
vector可以提供下标访问,即v[i]的方式,所以索引方便。然而如果要插入数据,尤其是在下标小的地方插入,需要把其后面所有的数据全部都往后移动一位,因此代价非常高。同样的,删除数据也是...
分类:
其他好文 时间:
2015-04-26 13:50:09
阅读次数:
103
问题:Add Two Numbers 难度-MediumYou 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 digit. Add the two nu...
分类:
其他好文 时间:
2015-04-25 18:27:50
阅读次数:
130
MySQL的强大之处在于它的插件式存储引擎,我们可以基于表的特点使用不同的存储引擎,从而达到最好的性能。MySQL有多种存储引擎:MyISAM、InnoDB、MERGE、MEMORY(HEAP)、BDB(BerkeleyDB)、EXAMPLE、FEDERATED、ARCHIVE、CSV、BLACKH...
分类:
数据库 时间:
2015-04-25 15:04:03
阅读次数:
230
问题描述: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 si...
分类:
编程语言 时间:
2015-04-25 13:37:32
阅读次数:
129
#对于迭代器,产生的是对象临时副本,不能修改对象。for i in lists: change(i)#在循环中修改迭代器迭代对象的地址,需要在while循环中重新迭代,不能继续在原有循环中while list: next=[] for i in list: do some thin...
分类:
编程语言 时间:
2015-04-25 13:32:56
阅读次数:
115
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from ...
分类:
其他好文 时间:
2015-04-25 12:17:30
阅读次数:
121
原题: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 singl...
分类:
编程语言 时间:
2015-04-24 22:43:07
阅读次数:
186