码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
[LeetCode] Search in Rotated Sorted Array 在旋转有序数组中搜索
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...
分类:编程语言   时间:2015-03-10 13:40:27    阅读次数:144
LeetCode | # 23
题目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思路: 解法一:维护一个大小为k的堆,每次去堆顶的最小元素放到结果中,然后读取该元素的下一个元素放入堆中,重新维护好。因为每个链表是有序的,每次又是去当前k个元素中最小的,...
分类:其他好文   时间:2015-03-09 22:32:10    阅读次数:203
LeetCode-108 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. 如果root有左子节点,则所有左边的节点root; 3. root.lef.....
分类:其他好文   时间:2015-03-09 20:48:13    阅读次数:182
leetcode:Search in Rotated Sorted Array II(duplicated)
题目要求:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a functi...
分类:其他好文   时间:2015-03-09 20:36:53    阅读次数:163
leetcode:Search in Rotated Sorted Array
题目要求: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 va...
分类:其他好文   时间:2015-03-09 18:57:19    阅读次数:186
Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ...
分类:其他好文   时间:2015-03-09 15:52:47    阅读次数:92
[LeetCode] Search a 2D Matrix 搜索一个二维矩阵
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:其他好文   时间:2015-03-09 14:09:06    阅读次数:151
LeetCode_Merge Two Sorted Lists
题目链接:https://leetcode.com/problems/merge-two-sorted-lists/ 题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two ...
分类:其他好文   时间:2015-03-09 11:05:29    阅读次数:134
Merge Sorted Array
Merge Sorted Array问题:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size tha...
分类:其他好文   时间:2015-03-08 21:28:44    阅读次数:122
Remove Duplicates from Sorted Array II
Remove Duplicates from Sorted Array II问题:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array ...
分类:其他好文   时间:2015-03-08 21:19:36    阅读次数:132
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!