On Jul 9, 3:55 pm, Devendra Pratap Singh <dpsingh.ii...@gmail.com> wrote: > plz write a code to > > Sort n integer in the range 1 to n^2 in O(n)
Use radix sort with radix n. Three O(n) passes will always do the job. If you subtract 1 from each value so the range is 0 to n^2-1, two passes will be enough. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.