码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
LeetCode--Sort List
Sort a linked list in O(n log n) time using constant space complexity. MergeSort对于链表的排序,实现了就地排序的同时,时间复杂度和空间复杂度都达到了基于比较的排序的最优值,因此归并排序是链表排序的最佳排序方式。 /** * Definition for singly-linked list. * str...
分类:其他好文   时间:2015-01-15 16:01:52    阅读次数:193
[leetcode] Factorial Trailing Zeroes
Factorial Trailing ZeroesGiven an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.思路:不...
分类:其他好文   时间:2015-01-15 15:57:13    阅读次数:158
LeetCode--Single Number
Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using ext...
分类:其他好文   时间:2015-01-15 11:05:40    阅读次数:207
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 without usi...
分类:其他好文   时间:2015-01-15 11:03:15    阅读次数:157
Single Number
Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using ext...
分类:其他好文   时间:2015-01-14 23:01:20    阅读次数:402
【leetcode】Median of Two Sorted Arrays(hard)★!!
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-14 00:42:38    阅读次数:278
[leetcode]23 Merge k Sorted Lists
问题描述: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 代码: public ListNode mergeTwoLists(ListNode l1, ListNode l2) { //java if(l2 == nu...
分类:其他好文   时间:2015-01-13 21:34:54    阅读次数:193
Sort List
Sort a linked list in O(n log n) time using constant space complexity. #include #include typedef struct ListNode{ int val; struct ListNode *next; }ListNode; ListNode *mergesort(ListNode *...
分类:其他好文   时间:2015-01-13 17:42:46    阅读次数:113
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 function to determine if a given target is in the...
分类:其他好文   时间:2015-01-13 12:33:11    阅读次数:118
LeetCode172——Factorial Trailing Zeroes
LeetCode172——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,...
分类:其他好文   时间:2015-01-13 01:27:55    阅读次数:142
1097条   上一页 1 ... 75 76 77 78 79 ... 110 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!