码迷,mamicode.com
首页 >  
搜索关键字:merge lists    ( 6727个结果
leetcode_21_Merge Two Sorted Lists
思路: 好像是数据结构上面的原题,就不多说了,通过比较把两个链表一起就可以了。需要注意的就是两个链表的head谁当新表的head问题,当然谁小谁当head 了,先比较一下即可。...
分类:其他好文   时间:2015-02-03 13:25:52    阅读次数:174
erlang lists模块函数使用大全
http://qqdenghaigui.iteye.com/blog/1554541一,带函数Pred1, all(Pred, List) -> boolean()如果List中的每个元素作为Pred函数的参数执行,结果都返回true,那么all函数返回true,否则返回false例子:lists:...
分类:其他好文   时间:2015-02-03 12:49:34    阅读次数:224
LeetCode:Merge Sorted Array
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 B....
分类:其他好文   时间:2015-02-02 23:12:19    阅读次数:171
[LeetCode]Add Two Numbers
Q: 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 digit. Add the two numbers and return it as ...
分类:其他好文   时间:2015-02-02 23:06:26    阅读次数:153
How to debug the CPU usage 100
Read the following lists:http://improve.dk/debugging-in-production-part-1-analyzing-100-cpu-usage-using-windbg/http://improve.dk/debugging-in-producti...
分类:其他好文   时间:2015-02-02 23:03:32    阅读次数:141
【leetcode】Intersection of Two Linked Lists(easy)
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a...
分类:其他好文   时间:2015-02-02 22:41:30    阅读次数:141
Leetcode#88 Merge Sorted Array
原题地址如果不使用额外的空间,可以先将A数组整体向后挪n个单位,然后开始常规的merge操作代码: 1 void merge(int A[], int m, int B[], int n) { 2 int i = m - 1; 3 int j = 0; 4 ...
分类:其他好文   时间:2015-02-02 19:42:49    阅读次数:144
Leetcode#160 Intersection of Two Linked Lists
原题地址先将A链末尾和B链头部接起来然后判断是否有环,如果无环,说明肯定不想交,如果有环,那么相交的位置就是环开始的位置第一遍做的时候没遇到什么问题,第二遍做的时候各种出错,后来发现原来在用快慢指针法的时候快慢指针要从起点开始,否则计算出来的第一个相交位置不是环开始的位置。。代码: 1 ListNo...
分类:其他好文   时间:2015-02-02 19:42:17    阅读次数:165
1sting
///题解 : 找规律,大菲波数Problem DescriptionYou will be given a string which only contains ‘1’; You can merge two adjacent ‘1’ to be ‘2’, or leave the ‘1’ ther...
分类:其他好文   时间:2015-02-01 23:08:42    阅读次数:227
erlang中list和ets的查找
最近发现一个ets和list的查找小问题,以前一直没有注意,问题是这样的,一样的数据在list中能够查到,但是在ets中查不到: 从上图可以看出,对于list中可以使用2.0找到2,但是在ets中却不行,说明lists中查找使用的是==而ets中使用的是=:=,虽然不是什么特别严重问题,但是可能会在代码中留下难以发现的bug...
分类:其他好文   时间:2015-02-01 21:55:09    阅读次数:232
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!