码迷,mamicode.com
首页 >  
搜索关键字:sorted lists    ( 7805个结果
Leetcode:Convert Sorted List to Binary Search Tree
Description :Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.分析:这道题目简单版是把一个排序好的数组转成平衡的二叉树...
分类:其他好文   时间:2014-06-16 10:51:54    阅读次数:237
[leetcode]Remove Duplicates from Sorted List II @ Python
原题地址:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list-ii/题意:Given a sorted linked list, delete all nodes that have duplicate number...
分类:编程语言   时间:2014-06-16 10:40:35    阅读次数:340
Leetcode: Merge k Sorted List
参看别人的思路,类似MergeSort的思路,思路是先分成两个子任务,然后递归求子任务,最后回溯回来。这个题目也是这样,先把k个list分成两半,然后继续划分,直到剩下两个list就合并起来,合并时会用到Merge Two Sorted Lists这道题。 1 /** 2 * Definition....
分类:其他好文   时间:2014-06-16 08:26:57    阅读次数:150
[leetcode]Search in Rotated Sorted Array II @ Python
原题地址:https://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/题意:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed...
分类:编程语言   时间:2014-06-16 08:20:54    阅读次数:307
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.递归,二分法。 1 /** 2 * Definition for binary tree 3 * st.....
分类:其他好文   时间:2014-06-16 00:33:31    阅读次数:252
[LeetCode] Search in Rotated Sorted Array [35]
旋转数组中的查找。[1, 2, 3, 4, 5, 6]的一个旋转数组为[4, 5, 6, 1, 2, 3]。在旋转数组中寻找一个数。 最直接的方法,一次遍历,时间复杂度O(n)。但是既然是一个部分有序的数组,那么对于有序的部分我们可以想方法用二分查找。这个效率可以提高。 代码: .......
分类:其他好文   时间:2014-06-15 17:33:21    阅读次数:195
Search for a Range
题目 Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target i...
分类:其他好文   时间:2014-06-15 16:53:32    阅读次数:177
[LeetCode] Search for a Range [34]
题目 Given a sorted array of integers, find the starting and ending position of a given target value. 解题思路: 查找一个数出现的范围,给一个排好序的数组和一个数,找出这个数在数组中出现的范围。 这个题直接使用一次遍历就可以得到结果,这样的时间复杂度为O(n)。但是对于有序数组我们一般可以使用二分查找可以得到更好的O(logn)的时间复杂度。我们可以使用二分查找找到这个数第一次出现的位置和这个数最后一次出现的位...
分类:其他好文   时间:2014-06-15 16:19:16    阅读次数:237
18 个最新实用的 jQuery 插件
1.Simple Effects for Drop-Down Lists一个jQuery插件用于将普通的select控件转成一个带有一些简单扩展效果的下拉列表。2.X-editable这个插件能够让你在页面上创建可编辑的元素。它能够使用任何引擎(bootstrap、jquery-ui、jquery)...
分类:Web程序   时间:2014-06-13 14:37:52    阅读次数:394
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!