码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
Python学习——数据排序方法
数据排序方法 原地排序sort()方法 复制排序sorted()函数
分类:编程语言   时间:2014-05-24 06:40:44    阅读次数:215
Leetcode | Search in Rotated Sorted Array I & II
Search in Rotated Sorted Array ISuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 ...
分类:其他好文   时间:2014-05-19 12:30:00    阅读次数:388
Leetcode | Remove Duplicates from Sorted Array I && II
Remove Duplicates from Sorted Array IGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new l...
分类:其他好文   时间:2014-05-19 12:10:41    阅读次数:329
[leetcode]_Merge Two Sorted Lists
题目:合并两个有序单链表思路:一开始想复杂了,以为必须在原链表上修改(绕来绕去还AC了,但是思路相当绕),其实没有,按照正常地合并两个数组同样的方法也对。代码:public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if(l1 ...
分类:其他好文   时间:2014-05-19 07:48:32    阅读次数:314
LeetCode: Remove Duplicates from Sorted Array [025]
【题目】 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For example, Given input array A ...
分类:其他好文   时间:2014-05-18 18:25:19    阅读次数:272
LeetCode: Next Permutation [030]
【题目】 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replac...
分类:其他好文   时间:2014-05-18 09:54:53    阅读次数:242
LeetCode: Merge k Sorted Lists [022]
【题目】 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 【题意】 合并K个有序链表 【思路】 归并 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For ...
分类:其他好文   时间:2014-05-18 09:05:40    阅读次数:255
Leetcode | Remove Duplicates from Sorted List I && II
Remove Duplicates from Sorted List IGiven a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->...
分类:其他好文   时间:2014-05-18 01:41:31    阅读次数:361
leetcode第一刷_Median of Two Sorted Arrays
这道题是我最初刷的那20多道之一,但一直没有过,被各种各样的情况折磨死了,直到把所有其他的题都写完,回来看大神对这道题是怎么处理的时候,才惊叹算法的奇妙。再次验证了我的想法,如果要处理各种各样的特殊情况,一定是算法本身有问题。 之前看过很多有关在两个排序数组中找中位数的解法,大多根据两个数组长度不同分了很多种情况,各种讨论。下面要介绍的方法并没有直接求中位数,而是把求中位数转换成了求两个数组合并...
分类:其他好文   时间:2014-05-15 12:21:05    阅读次数:273
LeetCode Search in Rotated Sorted Array II
class Solution {public: bool search(int A[], int n, int target) { if (n A[mid]) { right = mid; sep = A[mid]; ...
分类:其他好文   时间:2014-05-15 09:29:52    阅读次数:177
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!