码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
【链表】Sort List(归并排序)
题目:Sort a linked list inO(nlogn) time using constant space complexity.思路:nlogn的排序有快速排序、归并排序、堆排序。双向链表用快排比较适合,堆排序也可以用于链表,单向链表适合用归并排序。/** * Definition fo...
分类:编程语言   时间:2016-01-19 17:19:20    阅读次数:180
Leetcode 4. 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...
分类:其他好文   时间:2016-01-19 10:23:39    阅读次数:185
Factorial Trailing Zeroes
Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.Credits:Special thanks to@tsf...
分类:其他好文   时间:2016-01-18 20:33:30    阅读次数:141
[?]**Minimum Window Substring & String类问题模板
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S="ADOBECODEBA...
分类:Windows程序   时间:2016-01-15 15:55:36    阅读次数:516
LeetCode OJ: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...
分类:编程语言   时间:2016-01-15 14:19:38    阅读次数:163
LeetCode Power of Three
原题链接在这里:https://leetcode.com/problems/power-of-three/与Power of Two类似。检查能否被3整除,然后整除,再重复检查结果。Time Complexity: O(logn). n是原始数字。Space: O(1).AC Java: 1 pub...
分类:其他好文   时间:2016-01-08 23:40:30    阅读次数:213
LeetCode Pascal's Triangle II
原题链接在这里:https://leetcode.com/problems/pascals-triangle-ii/与Pascal's Triangle相似。用上一行作为历史记录算下一行,因为需要使用前面的历史数据,所以要从后往前更新res.Time Complexity: O(n^2). It d...
分类:其他好文   时间:2016-01-05 18:20:30    阅读次数:143
LeetCode - 4. 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 s....
分类:其他好文   时间:2016-01-04 13:19:29    阅读次数:308
LeetCode 148:Sort List
Sort a linked list in O(n log n) time using constant space complexity. //题目要求:对链表进行排序 //解题思路:归并排序,再Merge //归并排序的基本思想是:找到链表的中间节点,然后递归对前半部分和后半部分分别进行归并排序,最后对两个排好序的链表进行Merge class Solution { public: ...
分类:其他好文   时间:2016-01-03 17:38:48    阅读次数:159
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...
分类:其他好文   时间:2016-01-02 22:29:36    阅读次数:200
1097条   上一页 1 ... 35 36 37 38 39 ... 110 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!