Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Specific Sorting Algorithm Trouble

Name: Anonymous 2012-03-11 21:27

Sup /prog/,

So, I'm having trouble finding out what my professor meant by this, not sure if it's a typo because he often has typo's in his assignments. If the range was simply 1 to m, I would just use counting or bucket sort, but since it's 1 to m^2, I really have no clue. Thanks for any help I can get on this. Here's the problem:

Let x1, x2,…,xn be a sequence of integers in the range 1 to m^2. Describe an algorithm to sort this sequence in time O(n + m).

Name: Anonymous 2012-03-11 22:54

>>8
Actually it doesn't, I just realized.

Let m = 5, and Arr = [1, m^2] = [1, 25]

It will take 25 seconds, and thats just including the sleeping, what about the time we spend running through the array making new threads? It needs to run in O(n + m), radix sort is the only way as far as I know.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List