G 家的题目 讨论# JobHunting - 待字闺中d*o2012-06-14 07:061 楼Give some scenarios where you might favor O(n^2) algorithm over a O(nlg(n)) one"
p*22012-06-14 07:062 楼same space complexity?【在 d****o 的大作中提到】: Give some scenarios where you might favor O(n^2) algorithm over a O(nlg: (n)) one"
b*v2012-06-14 07:063 楼O(n^2)实现简单(不易出错)而且够快就没必要用实现复杂的O(n logn)【在 d****o 的大作中提到】: Give some scenarios where you might favor O(n^2) algorithm over a O(nlg: (n)) one"
g*s2012-06-14 07:066 楼yes. that's what i used when there was no sort apifor i = 1 to n-1for j = i+1 to nif (a[i] > a[j]){x=a[i];a[i]=a[j];a[j]=x;}【在 K*******i 的大作中提到】: n比较小的时候的排序?: 比如快排递归到n小的时候用插入排序?
s*n2012-06-14 07:067 楼Just a guess: suppose O(n^2) = C_1*n^2 and O(nlog(n)) = C_2*nlog(n) then forn such that C_1*n^2 < C_2*nlog(n) ,i.e. when n/log(n) < C_2/C_1 we preferthe former ?