码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
poj 1094 Sorting It All Out[ topo]
传送门: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
[ACM] POJ 1094 Sorting It All Out (拓扑排序)
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
LeetcodeOJ: Merge k Sorted Lists 归并排序+最小堆
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
[LeetCode] Convert Sorted List to Binary Search Tree 将有序链表转为二叉搜索树
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
LeetCode Remove Duplicates from Sorted Array
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
[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.这道题是要将有序数组转为二叉搜索树,所谓二叉搜索树,是一种始终满足左 &num) { ret...
分类:编程语言   时间:2015-02-17 15:18:17    阅读次数:201
Python的排序
Python内置函数sorted可以对可迭代对象进行排序,其中有cmp和key两个参数,这两个参数对排序的效率有很大的影响。...
分类:编程语言   时间:2015-02-17 00:48:35    阅读次数:243
leetcode 109. Convert Sorted List to Binary Search Tree
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
Binary Search (二分查找)
思路就是砍一半, 适用于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
109.Convert Sorted List to Binary Search Tree Leetcode Python
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!