The problem:Sort a linked list inO(nlogn) time using constant space complexity.My analysis:The is problem could be elegantly solved by using merge.The...
分类:
其他好文 时间:
2015-01-07 01:50:28
阅读次数:
112
The problem:Sort a linked list inO(nlogn) time using constant space complexity.My analysis:The idea behind this problem is easy : merge sort !But we s...
分类:
其他好文 时间:
2015-01-07 00:28:58
阅读次数:
181
【题目】
Merge k sorted
linked lists and return it as one sorted list. Analyze and describe its complexity.
【分析】
无
【代码】
/*********************************
* 日期:2015-01-06
* 作者:SJF0115
* 题目:...
分类:
其他好文 时间:
2015-01-06 23:10:50
阅读次数:
202
The problem:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must b...
分类:
其他好文 时间:
2015-01-06 13:46:08
阅读次数:
90
计算复杂性理论(Computational complexity theory)是理论计算机科学和数学的一个分支,它致力于将可计算问题根据它们本身的复杂性分类,以及将这些类别联系起来。一个可计算问题被认为是一个原则上可以用计算机解决的问题,亦即这个问题可以用一系列机械的数学步骤解决,例如算法。
如果一个问题的求解需要相当多的资源(无论用什么算法),则被认为是难解的。计算复杂性理论通过引入数学...
分类:
编程语言 时间:
2015-01-06 12:02:52
阅读次数:
194
The problem:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a...
分类:
其他好文 时间:
2015-01-06 09:42:10
阅读次数:
185
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-05 18:49:03
阅读次数:
105
题目:
Given an array of integers, every element appears three times except for one. Find that single one.
Your algorithm should have a linear runtime complexity. Could you implement it without using e...
分类:
其他好文 时间:
2015-01-05 16:41:37
阅读次数:
178
题目:
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 us...
分类:
编程语言 时间:
2015-01-04 23:10:13
阅读次数:
286
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)).
public class Solution {
pu...
分类:
其他好文 时间:
2015-01-04 21:25:03
阅读次数:
150