码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
LeetCode - Search in Rotated Sorted Array II
题目:Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a functi...
分类:其他好文   时间:2015-12-06 11:19:26    阅读次数:124
LeetCode Plus One
原题链接在这里:https://leetcode.com/problems/plus-one/特殊情况是 全是9时需要新建一个数组。Time Complexity: O(n), Space O(n).AC Java: 1 public class Solution { 2 public in...
分类:其他好文   时间:2015-12-05 07:12:29    阅读次数:117
Sort List
Sort a linked list in O(n log n) time using constant space complexity. 1、使用快排:交换的次数太多,超过时间限制 选择第一个值为基准值,然后比较 #include // Definition for singly-linked ...
分类:其他好文   时间:2015-12-04 20:47:53    阅读次数:177
LeetCode解题报告--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 is not f...
分类:其他好文   时间:2015-12-04 14:53:12    阅读次数:228
Median of Two Sorted Arrays
There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should...
分类:其他好文   时间:2015-12-02 17:55:53    阅读次数:130
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 ord...
分类:其他好文   时间:2015-11-28 11:59:55    阅读次数:126
Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.如果直接遍历链表数组,时间复杂度为T(n)=T(n-1)+o(lenn);即合并前n-1个链表的时间+与第n...
分类:其他好文   时间:2015-11-28 10:27:30    阅读次数:155
[LintCode] Sort List
Sort ListSort a linked list inO(nlogn) time using constant space complexity.ExampleGiven1-3->2->null, sort it to1->2->3->null.SOLUTION:这题是merge 2 sort...
分类:其他好文   时间:2015-11-17 12:24:58    阅读次数:119
LeetCode 34 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 ord...
分类:其他好文   时间:2015-11-17 08:24:29    阅读次数:113
Java [leetcode 34]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 th...
分类:编程语言   时间:2015-11-12 21:54:09    阅读次数:321
1097条   上一页 1 ... 37 38 39 40 41 ... 110 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!