码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
[Leetcode] Median of Two Sorted Arrays
Question: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 s...
分类:其他好文   时间:2014-06-21 08:34:52    阅读次数:172
[LeetCode] Search in Rotated Sorted Array
循环有序 一共有以下两种情况 第一种 / / // / / 条件:(A[mid] >= A[low]) ,low~mid 二分,mid~high 递归第二种 / / / / / / 条件:(A[mid] A[mid])12 ...
分类:其他好文   时间:2014-06-19 06:46:36    阅读次数:303
[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-06-18 20:54:36    阅读次数:202
[LeetCode] 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 ...
分类:其他好文   时间:2014-06-18 17:39:11    阅读次数:260
LeetCode: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 that is greater or equal to m + n) to hold additional ele...
分类:其他好文   时间:2014-06-17 23:05:13    阅读次数:246
Merge k Sorted Lists
题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 方法 使用归并排序的思想,两两合并,直到最终变成一个。 public ListNode mergeKLists(ArrayList lists) {...
分类:其他好文   时间:2014-06-17 21:34:41    阅读次数:183
二叉查找树(binary search tree)详解
二叉查找树(Binary Search Tree),也称二叉排序树(binary sorted tree),是指一棵空树或者具有下列性质的二叉树:若任意节点的左子树不空,则左子树上所有结点的值均小于它的根结点的值任意节点的右子树不空,则右子树上所有结点的值均大于它的根结点的值任意节点的左、右子树也分...
分类:其他好文   时间:2014-06-16 23:32:04    阅读次数:199
leetcode——Remove Duplicates from Sorted List II 删除排序字符串中重复字符(AC)
没什么太多讲的,可以使用递归和迭代两种方法来做,要仔细考虑各种输入情况。code如下:...
分类:其他好文   时间:2014-06-15 15:09:59    阅读次数:145
【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 from left to right.The first integer of each...
分类:其他好文   时间:2014-06-15 14:12:44    阅读次数:238
[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-06-14 16:08:32    阅读次数:200
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!