码迷,mamicode.com
首页 >  
搜索关键字:listnode    ( 1413个结果
(java) Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next; 6 * ListNode(int x) { 7 * ...
分类:编程语言   时间:2014-07-16 17:45:41    阅读次数:226
两个有序链表连接(归并排序中用到的)
刚才写了k个,顺手写个2个的,在链表的归并排序中很有用,效率非常好 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next;...
分类:其他好文   时间:2014-07-16 17:42:41    阅读次数:275
【leetcode】Reorder List (python)
问题的思路是这样: 循环取头部合并,其实也可以换个角度来看,就是将后面的链表结点,一次隔空插入到第一部分的链表中。 class Solution: # @param head, a ListNode # @return nothing def reorderList(self, head): if None == head or None == ...
分类:编程语言   时间:2014-07-16 17:23:30    阅读次数:207
【leetcode】Linked List Cycle (python)
题目分析见这里 class Solution: # @param head, a ListNode # @return a list node def detectCycle(self, head): if None == head or None == head.next: return None pfast = ...
分类:编程语言   时间:2014-07-16 17:18:53    阅读次数:248
变长结构体的使用
在分析安卓源码过程中看到几处使用变长结构体的例子,比如下面的结构体: struct command { /* list of commands in an action */ struct listnode clist; int (*func)(int nargs, char **args); int nargs; char *args[1]; ...
分类:其他好文   时间:2014-07-16 16:16:29    阅读次数:381
[LeetCode] Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.#include#includeusing namespace std;struct ListNode ...
分类:其他好文   时间:2014-07-16 15:17:03    阅读次数:188
【leetcode】Linked List Cycle (python)
class Solution: # @param head, a ListNode # @return a boolean def hasCycle(self, head): if None == head or None == head.next: return False pfast = head ...
分类:编程语言   时间:2014-07-16 09:50:21    阅读次数:271
leetcode——Insertion Sort List 对链表进行插入排序(AC)
Sort a linked list using insertion sort. class Solution { public: ListNode *insertionSortList(ListNode *head) { if(head == NULL || head->next == NULL) return head; Lis...
分类:其他好文   时间:2014-07-15 12:22:53    阅读次数:244
Android中的双向链表
1.看源码必须搞懂Android的数据结构。在init源代码中双向链表listnode使用很多,它只有prev和next两个指针,没有任何数据成员。这个和linux内核的list_head如出一辙,由此可见安卓深受linux内核的影响的。本来来分析一下这个listnode数据结构。 这里需要考虑的一个问题是,链表操作都是通过listnode进行的,但是那不过是个连接件,如果我们手上有个宿主结构,...
分类:移动开发   时间:2014-07-14 18:13:24    阅读次数:435
maredit测试
int main(){}void addTotail(ListNode *& pHead, int value){ ListNode *node = new ListNode(); node->value = value; node->pNext = NULL; ListNode *p = pHea...
分类:其他好文   时间:2014-07-13 21:11:59    阅读次数:173
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!