English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Assume that we are given a set of n numbers with many repetitions.The number of distinct values is k,where k is much smaller than n.Using comparisons only,develop an algoritham that sorts the elements of the set in O(n log k) time in the worst case.

2007-12-08 04:56:06 · 1 answers · asked by Anonymous in Computers & Internet Programming & Design

1 answers

You don't state whether or not the numbers are integers. If so, radix sort satisfies your criteria; it has performance of O(n log k) where the log is to the base in which the integers are represented.

2007-12-08 05:03:10 · answer #1 · answered by jgoulden 7 · 0 0

fedest.com, questions and answers