Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Comments
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

1 solution

Quote:
How do I implement the following question

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900