码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
leetcode 题解:Search in Rotated Sorted Array II (旋转已排序数组查找2)
题目:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function...
分类:其他好文   时间:2014-07-07 00:14:37    阅读次数:186
Leetcode | Sort List
Sort a linked list in O(n log n) time using constant space complexity.merge sort、heap sort和quick sort都是O(nlgn),但是mergesort和quicksort都是递归的,不是constant s...
分类:其他好文   时间:2014-07-06 21:07:41    阅读次数:210
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-07-06 13:17:57    阅读次数:199
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 O(log (m+n)). 有两个已排序的数组A和B,大小为m 和 n。 找出两数组的中...
分类:其他好文   时间:2014-07-05 22:54:17    阅读次数:244
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-05 19:10:48    阅读次数:219
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-03 21:59:51    阅读次数:199
Leetcode Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.合并k个排序列表解题思路是:取出 k个元素进行堆排序,每次取出最小的元素,插入链表中即可注意本题利用了c++...
分类:其他好文   时间:2014-07-02 20:16:54    阅读次数:273
LeetCode: Sort List [148]
【题目】 Sort a linked list in O(n log n) time using constant space complexity. 【题意】 排序一个链表,要求时间复杂度O(nlogn),使用常量空间 【思路】 nlogn的复杂度,用归并排序求解...
分类:其他好文   时间:2014-07-02 09:25:40    阅读次数:252
Leetcode:Sort List 对单链表归并排序
Sort a linked list in O(n log n) time using constant space complexity. 看到O(n log n)的排序算法,适合单链表的首先想到的就是归并排序 /** * Definition for singly-linked list. * struct ListNode { * int val; * Lis...
分类:其他好文   时间:2014-07-02 08:47:34    阅读次数:239
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 witho...
分类:其他好文   时间:2014-07-01 06:24:42    阅读次数:204
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!