15,610,483 members
See more:
Let S1, S2, . . . , Sk be k different sequences whose elements have integer keys in the range [0,N − 1], for some parameter N ≥ 2. Describe an algorithm running in O(n+N) time for sorting all the sequences, where n denotes the total size of all the sequences.

What I have tried:

I am not getting the basic idea for this
Posted
Updated 27-Feb-21 23:16pm
Daniel Pfeffer 28-Feb-21 4:29am
This sounds like a homework problem. If you don't understand it, why not ask your teacher to explain it again to you? That's his/her job...
Aryan Khanna 28-Feb-21 4:48am
Our teacher is not very helpful
He just tells us to try on our own
Richard MacCutchan 28-Feb-21 4:58am
Exactly right, as the whole point of this question (and all other assignments) is to test how much you have learned, and how much research you can do on your own. You could start by creating some of the mentioned sequences on paper and think about how you would go about sorting the numbers.
Aryan Khanna 28-Feb-21 5:01am
I just have one doubt
Do I have to use radix sort?
Aryan Khanna 28-Feb-21 5:02am
But in this case for the time complexity they've given that n should be the sum if the size of the sequences

## Solution 1

Quote:
How do I implement the following question

Have a look here:
Counting Sort - GeeksforGeeks[^]
Counting sort - Wikipedia[^]