码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
Find Minimum in Rotated Sorted Array
1 package leetcode; 2 /* * 3 * 注意问题: 4 * 1. 原序列升序、降序问题,两种情况都要考虑 5 * 2. 边界问题,如果只有两个元素时要单独考虑,在num[mid]==num[left]判断中考虑 6 * 3. 采用2叉查找的思想 7 * */ 8 p...
分类:其他好文   时间:2014-11-17 00:19:52    阅读次数:223
Leetcode-Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted fr...
分类:其他好文   时间:2014-11-17 00:17:02    阅读次数:215
Merge k Sorted Lists
题目:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路:我的第一个想法是将lists中的链表两两合并排序,这样时间复杂度是o(n),n为所有链表中的数据...
分类:其他好文   时间:2014-11-16 18:31:00    阅读次数:209
Skip List
Skip List | Set 1 (Introduction)Can we search in a sorted linked list in better than O(n) time?The worst case search time for a sorted linked list is ...
分类:其他好文   时间:2014-11-16 15:49:53    阅读次数:173
Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:其他好文   时间:2014-11-16 14:38:00    阅读次数:175
Leetcode-Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should ....
分类:其他好文   时间:2014-11-16 08:14:58    阅读次数:196
Leetcode-Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2...
分类:其他好文   时间:2014-11-16 08:14:02    阅读次数:220
[Leetcode] Search in Rotated Sorted Array II
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-16 08:12:43    阅读次数:145
Leetcode-Remove Duplicates from Sorted List
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,...
分类:其他好文   时间:2014-11-16 08:11:30    阅读次数:220
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...
分类:其他好文   时间:2014-11-16 08:11:04    阅读次数:178
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!