码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
[leetcode]Merge Two Sorted Lists
Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the fir...
分类:其他好文   时间:2014-07-22 22:51:35    阅读次数:146
[leetcode]Merge k Sorted Lists
Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.这道题,第一次刷是过了,第二次同样的代码超时了,看来case是在不断...
分类:其他好文   时间:2014-07-22 22:50:32    阅读次数:237
[leetcode]Remove Duplicates from Sorted List
Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, r...
分类:其他好文   时间:2014-07-21 09:38:07    阅读次数:199
[leetcode]Remove Duplicates from Sorted List II
Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the or...
分类:其他好文   时间:2014-07-21 09:33:03    阅读次数:218
LeetCode:Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:其他好文   时间:2014-07-21 09:08:29    阅读次数:209
Convert Sorted Array to Binary Search Tree
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ...
分类:其他好文   时间:2014-07-21 00:11:12    阅读次数:254
poj1094Sorting It All Out
题目链接: 啊哈哈,选我 题目: Sorting It All Out Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 26897   Accepted: 9281 Description An ascending sorted s...
分类:其他好文   时间:2014-07-20 23:22:58    阅读次数:301
LeetCode:Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:其他好文   时间:2014-07-19 22:19:36    阅读次数:202
poj 1094 / zoj 1060 Sorting It All Out
Sorting It All OutTime Limit:1000MSMemory Limit:10000KTotal Submissions:26876Accepted:9271DescriptionAn ascending sorted sequence of distinct values i...
分类:其他好文   时间:2014-07-19 15:03:58    阅读次数:278
STL 源码剖析 算法 stl_algo.h -- merge
merge (应用于有序区间) -------------------------------------------------------------------------- 描述:将两个经过排序的集合S1和S2,合并起来置于另一段空间。所得结果也是一个有序(sorted)序列 思路: 1.遍历两个序列直到其中一个结束了 2.如果序列一的元素较小,将它放到结果序列中,并前进 1 3.如果序列二的元素较小,将它放到结果序列中,前前进 1 4.遍历结束后,将还没有遍历完的序列复制到结果序列的尾部 源码:...
分类:其他好文   时间:2014-07-19 08:16:09    阅读次数:212
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!