Count sort is O(n+k), since k~n^2 here, it will be O(N^2). Radix sort has complexity O(r.n) which is nearly O(n logn). Are you sure that the person asking this question wanted O(n) ?
On Jun 26, 1:31 pm, radha krishnan <[email protected]> wrote: > Yes ! Count Sort !! > > > > > > > > On Sun, Jun 26, 2011 at 1:44 PM, ross <[email protected]> wrote: > > Given a sequence of numbers in the range of 1-N^2, what is the most > > efficient way to sort the numbers (better than NlgN).. > > Can counting sort be used here? Is an O(N) solution possible.. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
