w**q 发帖数: 3 | 1 Implement an algorithm to sort a linked list. Why did you pick the method
you did? Now do it in O(n) time.
how to get O(n)???
The famous sort algorithms are all O(nlog(n))
thanks a lto! |
d*****u 发帖数: 17243 | 2 如果不计memory成本的话,是可以有O(n)的time complexity的
比如bucket sort
【在 w**q 的大作中提到】 : Implement an algorithm to sort a linked list. Why did you pick the method : you did? Now do it in O(n) time. : how to get O(n)??? : The famous sort algorithms are all O(nlog(n)) : thanks a lto!
|
g*****g 发帖数: 34805 | 3 Only counting sort is O(n), if you know the range.
【在 w**q 的大作中提到】 : Implement an algorithm to sort a linked list. Why did you pick the method : you did? Now do it in O(n) time. : how to get O(n)??? : The famous sort algorithms are all O(nlog(n)) : thanks a lto!
|
r*******n 发帖数: 3020 | 4 The sort algorithms based on comparison are limited by nlogn
【在 w**q 的大作中提到】 : Implement an algorithm to sort a linked list. Why did you pick the method : you did? Now do it in O(n) time. : how to get O(n)??? : The famous sort algorithms are all O(nlog(n)) : thanks a lto!
|