码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
[LeetCode]148.Merge Two Sorted Lists
【题目】 Sort a linked list in O(n log n) time using constant space complexity. 【分析】 单链表适合用归并排序,双向链表适合用快速排序。本题可以复用Merge Two Sorted Lists方法 【代码】 /********************************* * 日期:2015-01-1...
分类:其他好文   时间:2015-01-13 00:10:40    阅读次数:184
【leetcode】Merge k Sorted Lists
Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.采用优先队列priority_queue把ListNode放入优先队...
分类:其他好文   时间:2015-01-12 23:57:44    阅读次数:266
【leetcode】Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路:我自己的,每次找k个元素的最小的接在答案链表的后面。结果超时了。 ListNode *merge...
分类:其他好文   时间:2015-01-12 23:44:13    阅读次数:249
[LeetCode] 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...
分类:其他好文   时间:2015-01-12 22:25:47    阅读次数:451
Leetcode: Find Minimum in Rotated Sorted Array II
Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose a sorted array is rotated at some pivot u...
分类:其他好文   时间:2015-01-12 21:04:07    阅读次数:224
[LeetCode] 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...
分类:其他好文   时间:2015-01-12 14:25:06    阅读次数:126
Search for a Range -- leetcode
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 found in...
分类:其他好文   时间:2015-01-12 09:29:25    阅读次数:119
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 found ...
分类:其他好文   时间:2015-01-11 17:51:10    阅读次数:190
[C++]LeetCode: 88 Factorial Trailing Zeroes (阶乘后导零)
题目: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 思路: 我们要计算 N! 中有多少个后导0. 我们来找一下规律,考虑n!的质数因子。后缀0,只有可能是质因子2...
分类:编程语言   时间:2015-01-11 16:16:18    阅读次数:272
Median of 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-01-11 15:59:32    阅读次数:181
1097条   上一页 1 ... 76 77 78 79 80 ... 110 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!