码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
ACM && Find Minimum in Rotated Sorted Array
1 /*Find Minimum in Rotated Sorted Array */ 2 #include 3 #include 4 using namespace std; 5 6 int find(vector & num, int begin, int end) ; 7 int fi...
分类:其他好文   时间:2014-12-05 19:07:46    阅读次数:204
[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 TreeNode { * int val; * Tree...
分类:其他好文   时间:2014-12-05 17:34:59    阅读次数:169
【LeetCode】Insert Interval
题目 Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start tim...
分类:其他好文   时间:2014-12-05 15:30:44    阅读次数:207
LeetCode: Merge k Sorted Lists 解题报告
Merge k Sorted ListsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Show Tags参考资料: http://blog.csdn....
分类:其他好文   时间:2014-12-05 12:13:13    阅读次数:210
[leetcode]Search in Rotated Sorted Array II
问题描述: Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a function to determine if a given target is i...
分类:其他好文   时间:2014-12-04 23:21:47    阅读次数:461
[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. 基本思想: 二分法构建二差排序树。 代码: TreeNode *subsortedArrayToBST(vector & num,int begin, int end) /...
分类:其他好文   时间:2014-12-04 23:18:01    阅读次数:189
dict排序
-------------- >>>?a {‘a‘:?5,?‘c‘:?3,?‘b‘:?4,?‘e‘:?1,?‘d‘:?2} >>>?sorted(a.items()) [(‘a‘,?5),?(‘b‘,?4),?(‘c‘,?3),?(‘d‘,?2),?(‘e‘,?1)] >>>?sorted(aa.items(),key?=?lambda?d:d...
分类:编程语言   时间:2014-12-04 21:47:22    阅读次数:223
Remove Duplicates from Sorted List
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41728739 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. 思路: (1...
分类:其他好文   时间:2014-12-04 21:44:57    阅读次数:185
LeetCode[Array]: Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. ...
分类:其他好文   时间:2014-12-04 13:59:41    阅读次数:154
Search Insert Position
题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in...
分类:其他好文   时间:2014-12-03 23:06:05    阅读次数:176
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!