码迷,mamicode.com
首页 >  
搜索关键字:linked    ( 5490个结果
Partition List
题目 Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the node...
分类:其他好文   时间:2014-06-11 06:28:41    阅读次数:364
Reverse Linked List II
题目 Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m,...
分类:其他好文   时间:2014-06-11 06:07:11    阅读次数:392
Remove Duplicates from Sorted List
题目 Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 方法 遍...
分类:其他好文   时间:2014-06-11 00:41:44    阅读次数:207
LeetCode——
Add Two Numbers 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...
分类:其他好文   时间:2014-06-11 00:35:15    阅读次数:243
【Leedcode】Insertion Sort List
Sort a linked list using insertion sort. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *nex...
分类:其他好文   时间:2014-06-10 12:14:19    阅读次数:253
leetcode--Partition List
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi...
分类:其他好文   时间:2014-06-10 12:06:09    阅读次数:205
【leetcode】Merge Two Sorted Lists
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.水题不解释,一A,...
分类:其他好文   时间:2014-06-10 08:58:37    阅读次数:191
【leetcode】Flatten Binary Tree to Linked List
分析: 问题是将给定的二叉树变换成令一种形式,这种类型的问题,其模式是,将左子树变换成某种形式,右子树也变换成这种形式,然后再与根结点按规定的方式连接起来,那么整体就变换完成了。这个题我们就可以采用这种形式,麻烦的地方就是在进行连接的时候,我们假设根为root,左子树变换后的根为root_left,右子树变换后的根为 root_right,那么连接的时候应该是root->right = root...
分类:其他好文   时间:2014-06-10 07:27:10    阅读次数:201
【Leetcode】Sort List
Sort a linked list inO(nlogn) time using constant space complexity.单向链表排序O(nlogn),Mergesort可以实现。 1 /** 2 * Definition for singly-linked list. 3 * st.....
分类:其他好文   时间:2014-06-10 00:44:11    阅读次数:329
[LeetCode] Insertion Sort List
Sort a linked list using insertion sort.对于指针链表类题,分析时一定要用笔先清晰画出来,每个指针对应那些结点。对比:(1)插入排序的顺序表实现,是对temp从参考点temp往前与一个个元素比较,(2)插入排序的链表实现,是对temp从头结点开始往后与一个个元素...
分类:其他好文   时间:2014-06-09 17:27:30    阅读次数:187
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!