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
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
题目
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
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
问题描述:
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
问题描述:
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
-------------- >>>?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
本文是在学习中的总结,欢迎转载但请注明出处: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
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
题目: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