-2

I need to sort this elements in single pass of o(n) timecomplexity

Ex :1 0 2 0 0 3 0 3 2 0 0 1

  • Refer [this](http://stackoverflow.com/questions/2352313/is-there-an-on-integer-sorting-algorithm) – Dimuth Tharaka Menikgama Apr 19 '17 at 03:39
  • You also need to spend some time at the [help] to understand how to ask here. Even when you would ask on a "correct" subject... A question needs to contain more than "I need these requirements to be implemented" – GhostCat Apr 19 '17 at 03:58

1 Answers1

0

Assuming there is an upper bound on the values in the list you can use counting sort. Radix sort is another option.

http://en.wikipedia.org/wiki/Counting_sort

https://en.wikipedia.org/wiki/Radix_sort

Robert
  • 287
  • 1
  • 9