As I am reading a Book about "Algorithm Analysis", I came across count_sort Algorithm. A question has been raised in my head. I read in many other papers, that "Quick Sort/ Merge Sort" are the best and the most efficient sorting algorithms. However, the complexity of this Algorithms is O(n+k), same for Quick sort, and better than Merge sort O(n ln n).
My question:
What is the problem with this sorting Algorithm.
What are the best sorting Algorithms that I have to check ?
def count_sort(seq): b, c = [], defaultdict(list) for x in seq: c[x].append(x) for k in range(min(c), max(c)+1): b.extend(c[k]) return b
defaultdict
is implemented? – Greg Hewgill Sep 2 '14 at 2:27