转自:算法的空间复杂度类似于时间复杂度的讨论,一个算法的空间复杂度(Space Complexity)S(n)定义为该算法所耗费的存储空间,它也是问题规模n的函数。渐近空间复杂度也常常简称为空间复杂度。空间复杂度(Space Complexity)是对一个算法在运行过程中临时占用存储空间大小的量度。...
分类:
编程语言 时间:
2014-10-12 03:12:07
阅读次数:
264
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-10 23:59:54
阅读次数:
226
[leetcode]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))....
分类:
其他好文 时间:
2014-10-08 14:00:15
阅读次数:
147
Problem: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 sh...
分类:
其他好文 时间:
2014-10-08 00:27:44
阅读次数:
321
题目:Sort ListSort a linked list in O(n log n) time using constant space complexity看题目有两个要求:1)时间复杂度为O(nlogn);2)空间复杂度为常数,即不能增设额外的空间。满足这样要求的排序算法,我们首先想到快排,...
分类:
其他好文 时间:
2014-10-07 19:28:53
阅读次数:
245
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOBECODE...
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-10-05 17:36:28
阅读次数:
213
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S="ADOBECODEBA...
/*
*
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 u...
分类:
其他好文 时间:
2014-10-04 17:45:36
阅读次数:
163
/*
*
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 u...
分类:
其他好文 时间:
2014-10-04 14:32:16
阅读次数:
211