码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
[LeetCode] Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for binary tree * public class TreeN...
分类:其他好文   时间:2014-08-30 01:10:48    阅读次数:333
【leetcode 移除有序序列重复数字】Remove Duplicates from Sorted Array(List) I(II)
leetcode上有四道关于移除有序序列中重复数字的题目,其中两道为数组结构,两道为链表结构,分别为: (1)Remove Duplicates from sorted array I:移除一个有序数组中的重复数字,并且返回新数组的大小。 (2)Remove Duplicates from sorted array II:移除一个有序数组中的重复数字,并且返回新数组的大小,和上道题目不同的是每...
分类:其他好文   时间:2014-08-29 18:24:28    阅读次数:289
【leetcode】Merge k Sorted Lists (归并排序)
题目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 解析:合并k个有序链表,最后返回一个总的有序链表,分析并描述其复杂度。该题的实质为归并排序,平均时间复杂度为O(NlogN)。 ...
分类:其他好文   时间:2014-08-29 11:05:07    阅读次数:225
python中List的sort方法的用法
python列表排序简单记一下python中List的sort方法(或者sorted内建函数)的用法。关键字:python列表排序 python字典排序 sortedList的元素可以是各种东西,字符串,字典,自己定义的类等。sorted函数用法如下:Python代码sorted(data,cmp=...
分类:编程语言   时间:2014-08-29 10:37:57    阅读次数:240
[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.public cl...
分类:其他好文   时间:2014-08-29 01:16:36    阅读次数:267
【LeetCode】- Merge Sorted Array (合并有序数组)
[ 问题: ] Given two sorted integer arrays A and B, merge B into A as one sorted array. 直译:给定两个排好序的整形数组,将数组B合并到数组A,形成一个新的有序数组。...
分类:其他好文   时间:2014-08-28 14:53:19    阅读次数:214
Convert Sorted Array to Binary Search Tree & Convert Sorted List to Binary Search Tree
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.方法:将有序数组转为平...
分类:其他好文   时间:2014-08-27 23:17:18    阅读次数:278
43. Merge Sorted Array && LRU Cache
思想:因为 A 很大, 所以从最大值开始插入, 即从 A 的 m+n 位置开始插入数据。避免了冗余的移动。 思想: 1. 由于要 O(1) 时间确定某 key 是不是在 Cache 中,所以用 Hash_map (), 从而能够O(1)找到结点地址,返回对应的 value。 2. 由...
分类:其他好文   时间:2014-08-27 21:43:08    阅读次数:191
34. Convert Sorted List to Binary Search Tree && Convert Sorted Array to Binary Search Tree
思想: 以中间点为根节点,按先序顺序来创建 。
分类:其他好文   时间:2014-08-27 18:33:28    阅读次数:248
leetcode之Search in Rotated Sorted Array,剑指offer之旋转数组的最小数字
输入一个递增数组的旋转,...
分类:其他好文   时间:2014-08-27 16:39:18    阅读次数:196
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!