码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
Sort List leetcode java
题目:Sort a linked list in O(n log n) time using constant space complexity.题解:考虑到要求用O(nlogn)的时间复杂度和constant space complexity来sort list,自然而然想到了merge sor....
分类:编程语言   时间:2014-07-26 09:51:57    阅读次数:307
Merge k Sorted Lists leetcode java
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题解:Merge k sorted linked list就是merge 2 sorted li....
分类:编程语言   时间:2014-07-26 05:44:37    阅读次数:304
【leetcode刷题笔记】Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.题解:最开始用了最naive的方法,每次在k个链表头中找出最小的元素,插入到新链表中。结果果断TLE了。分析...
分类:其他好文   时间:2014-07-23 16:56:31    阅读次数:227
Median of Two Sorted Array leetcode java
题目: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 ...
分类:编程语言   时间:2014-07-23 11:49:36    阅读次数:357
【LeetCode】Single Number II
题目 Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it wit...
分类:其他好文   时间:2014-07-23 00:13:17    阅读次数:331
Search in Rotated Sorted Array II leetcode java
题目: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 funct....
分类:编程语言   时间:2014-07-22 22:47:55    阅读次数:214
【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-07-22 00:35:34    阅读次数:238
【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 ord...
分类:其他好文   时间:2014-07-22 00:13:35    阅读次数:154
[leetcode]Sort List
Sort ListSort a linked list inO(nlogn) time using constant space complexity.算法思想:时间复杂度为O(nlogn)的排序算法,有快排、归并、堆排序,快排需要往前遍历,因此不适合单链表,堆排序可以,但是需要O(n)的空间,因此...
分类:其他好文   时间:2014-07-22 00:03:35    阅读次数:187
Search for a Range leetcode java
题目: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....
分类:编程语言   时间:2014-07-21 11:14:07    阅读次数:203
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!