码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
LeetCode 154 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 unkno...
分类:其他好文   时间:2014-10-22 12:56:43    阅读次数:223
LeetCode 148 Sort List
Sort a linked list in O(n log n) time using constant space complexity. 思路:要想时间复杂度达到O(n log n) ,那么有两种,一种是合并排序,另一种是快速排序,而要想空间复杂度为常数,那么只能使用递归,本人使用的是递归的合并排序,代码如下: /** * Definition for s...
分类:其他好文   时间:2014-10-22 12:55:55    阅读次数:200
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-10-21 22:53:06    阅读次数:316
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...
分类:其他好文   时间:2014-10-21 17:25:09    阅读次数:185
Find Minimum in Rotated Sorted Array 2 寻找旋转有序数组的最小值之二
Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a sort...
分类:编程语言   时间:2014-10-21 17:04:11    阅读次数:226
leetcode第22题--Merge k Sorted Lists
problem:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.先合并两个list,再根据归并排序的方法递归合并。假设总共有k个list,每个list的最大...
分类:其他好文   时间:2014-10-20 02:00:03    阅读次数:197
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-10-19 18:18:19    阅读次数:188
[Leetcode] 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-10-16 05:43:32    阅读次数:160
数论 - 简单数位推理 --- NYIST 514
Problem's Link:http://acm.nyist.net/JudgeOnline/problem.php?pid=514Mean:给你一个l和r,求出在这个范围内的1的个数。analyse:简单的数位推理。Time complexity:O(n) n为数字的位数Source code:...
分类:其他好文   时间:2014-10-13 18:36:56    阅读次数:146
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...
分类:其他好文   时间:2014-10-12 16:06:48    阅读次数:185
1097条   上一页 1 ... 91 92 93 94 95 ... 110 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!