传送门:http://poj.org/problem?id=1094
Sorting It All Out
Description
An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elem...
分类:
其他好文 时间:
2015-02-20 09:46:55
阅读次数:
159
Sorting It All OutTime Limit:1000MSMemory Limit:10000KTotal Submissions:26801Accepted:9248DescriptionAn ascending sorted sequence of distinct values i...
分类:
编程语言 时间:
2015-02-18 16:24:49
阅读次数:
187
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne...
分类:
编程语言 时间:
2015-02-18 14:04:12
阅读次数:
148
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.这道题是要求把有序链表转为二叉搜索树,和之前那道Convert Sorted Ar...
分类:
其他好文 时间:
2015-02-18 08:24:13
阅读次数:
160
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...
分类:
其他好文 时间:
2015-02-17 21:05:58
阅读次数:
168
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.这道题是要将有序数组转为二叉搜索树,所谓二叉搜索树,是一种始终满足左 &num) { ret...
分类:
编程语言 时间:
2015-02-17 15:18:17
阅读次数:
201
Python内置函数sorted可以对可迭代对象进行排序,其中有cmp和key两个参数,这两个参数对排序的效率有很大的影响。...
分类:
编程语言 时间:
2015-02-17 00:48:35
阅读次数:
243
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.[Solution] 1 TreeNode *sortedListToBST(Li...
分类:
其他好文 时间:
2015-02-16 11:37:14
阅读次数:
126
思路就是砍一半, 适用于sorted array.时间复杂度O(lgn).每次都是取中间的跟target比较, 比target小的话目标值肯定在lower和mid之间, 比target大的话在mid和high之间~ 1 public int binarySearch(int num[], int t...
分类:
其他好文 时间:
2015-02-16 11:29:26
阅读次数:
131
Convert Sorted List to Binary Search Tree Total Accepted: 32343 Total Submissions: 117376 My Submissions Question Solution
Given a singly linked list where elements are sorted in ascending order, co...
分类:
编程语言 时间:
2015-02-16 09:04:34
阅读次数:
193