原题地址:https://oj.leetcode.com/problems/convert-sorted-list-to-binary-search-tree/题目内容:Given a singly linked list where elements are sorted in ascending...
分类:
其他好文 时间:
2014-11-23 21:34:38
阅读次数:
141
明日珠海行,心情紧张,写博文压压惊 囧-------------------------------------原题地址:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list-ii/题目内容:Given a sorte...
分类:
其他好文 时间:
2014-11-23 21:33:49
阅读次数:
180
void Insert(LinkedList * &start, int val){ LinkedList * cur = start; if (start == NULL) { auto l = new LinkedList(val); l->pre ...
分类:
其他好文 时间:
2014-11-23 17:22:34
阅读次数:
194
问题描述:
Suppose 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 1 2).
You are given a target value to search. If found in the array ...
分类:
其他好文 时间:
2014-11-23 16:04:30
阅读次数:
133
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.C++代码实现:#include#include#include#includeu...
分类:
其他好文 时间:
2014-11-23 15:53:30
阅读次数:
256
问题描述:
基本思想:
代码:
double findMedianSortedArrays(int A[], int m, int B[], int n) { //C++
int pre = 0;
int midpos = (m+n)/2;
bool isodd = (m+n)%2 == 1;...
分类:
其他好文 时间:
2014-11-23 14:33:47
阅读次数:
163
Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function to...
分类:
其他好文 时间:
2014-11-22 22:52:33
阅读次数:
262
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t...
分类:
其他好文 时间:
2014-11-22 21:30:59
阅读次数:
159
Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a sort...
分类:
其他好文 时间:
2014-11-22 20:07:33
阅读次数:
154
这个题目其实不难的,主要是我C++的水平太差了,链表那里绊了好久,但是又不像用python,所以还是强行上了。 题目如下: Given a sorted linked list, delete all duplicates such that each element appear only onc...
分类:
其他好文 时间:
2014-11-22 17:16:55
阅读次数:
177