码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
leetcode - [4]Sort List
Sort a linked list inO(nlogn) time using constant space complexity.思路:采用归并排序或者快速排序#include using namespace std;struct ListNode { int val; ListNo...
分类:其他好文   时间:2014-09-20 20:12:09    阅读次数:230
Leetcode: Median of Two 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 ...
分类:其他好文   时间:2014-09-20 05:40:07    阅读次数:282
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 ...
分类:其他好文   时间:2014-09-18 13:11:03    阅读次数:135
Leetcode: Sort List
Sort a linked list in O(n log n) time using constant space complexity.记得Insert Sort List, 那个复杂度是O(N^2)的,这里要求O(nlogn),所以想到merge sort, 需要用到Merge Two Sor...
分类:其他好文   时间:2014-09-18 01:57:43    阅读次数:199
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 ord...
分类:其他好文   时间:2014-09-17 13:31:02    阅读次数:144
Median of Two Sorted Arrays-LeetCode
题目: There are two sorted arrays A and B of size m and n respectively.Find the Median of two sorted arrays.The overall run time complexity should be O(...
分类:其他好文   时间:2014-09-15 14:19:58    阅读次数:170
leetcode sort List
Sort a linked list in O(n log n) time using constant space complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * ...
分类:其他好文   时间:2014-09-13 21:25:35    阅读次数:288
Sort List
Sort a linked list inO(nlogn) time using constant space complexity. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int ...
分类:其他好文   时间:2014-09-13 20:08:05    阅读次数:204
Single Number
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:其他好文   时间:2014-09-13 20:00:25    阅读次数:195
LeetCode Sort List
Sort a linked list inO(nlogn) time using constant space complexity.归并排序的基本思想是:找到链表的middle节点,然后递归对前半部分和后半部分分别进行归并排序,最后对两个以排好序的链表进行Merge。/** * Definitio...
分类:其他好文   时间:2014-09-13 13:15:45    阅读次数:155
1097条   上一页 1 ... 94 95 96 97 98 ... 110 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!