SkyRipper
SkyRipper

Reputation: 175

Sorting algorithms for unique data

What sorting algorithms perform better than quicksort when the data being sorted are:

a) unique
b) in completely random positions
c) large in number (>1m)
d) the data are in memory, in a vector
e) they are character arrays
f) I don't care how much memory the algorithm will use

I understand, this kind of question can have many variables, so I tried to provide as many information I could.

Upvotes: 0

Views: 74

Answers (1)

bolov
bolov

Reputation: 75707

Since you have character arrays and don't care about memory (although, you do are limited by the hardware memory available, so I don't know how you can not care) you can use Radix sort. It has a complexity of O(n). And you can also very easily parallelise this algorithm.

Upvotes: 2

Related Questions