码迷,mamicode.com
首页 >  
搜索关键字:linked    ( 5490个结果
63.如何对单链表进行快排?和数组快排的分析与对比[quicksort of array and linked list]
quick sort of array and linked list
分类:其他好文   时间:2014-06-03 08:16:22    阅读次数:359
LeetCode: Remove Duplicates from Sorted List [082]
【题目】 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. 【题意】 给定一个已排序的链表,删除其中的重复元素 【思路】 维护两个指针prev和cur, cur指针负责扫描链表,prev指向cur的前一...
分类:其他好文   时间:2014-06-03 04:05:39    阅读次数:231
LeetCode:Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…   You must do this in-place without altering the nodes' values.   For example, Given {1,2,3,4}, r...
分类:其他好文   时间:2014-06-03 03:12:46    阅读次数:222
LeetCode: Partition List [086]
【题目】 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 nodes in each of the two partitions. For example, Given 1->4->3-...
分类:其他好文   时间:2014-06-03 00:02:29    阅读次数:270
leetcode Reverse Nodes in k-Group
递归一下 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: Li...
分类:其他好文   时间:2014-06-01 17:35:40    阅读次数:406
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 ...
分类:其他好文   时间:2014-06-01 17:05:44    阅读次数:296
LeetCode: Reverse Linked List II [092]
【题目】 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, n satisfy the following condition: 1 ≤ m ≤ n ≤ length of list. 【题意】 ...
分类:其他好文   时间:2014-06-01 15:08:34    阅读次数:237
每日算法之二十二:Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space....
分类:其他好文   时间:2014-06-01 10:41:23    阅读次数:242
每日算法之二十三:Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is...
分类:其他好文   时间:2014-06-01 09:05:42    阅读次数:271
LeetCode: Remove Duplicates from Sorted List II [083]
【题目】 Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, Given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1->2->3, return 2->3. 【题意】 给定一个有序链表,删出其中重复出现的值...
分类:其他好文   时间:2014-05-31 21:14:11    阅读次数:333
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!