this is not d final solution, trying to find a way

3B, 1R, 4Y, 2R, 5B, 7Y

1) Find max no. in the array i.e 7
max=7

2) assign  values as R= max B=2*max Y=3*max
  i.e R=7 B=14 R=21

3)  3B = 3 + 14=17
     1R = 1 + 7 = 8
     4Y = 4 + 21 = 25 and so on

 4)  numbers are as follows
     17, 8, 25, 9,19,28

problem reduce to sort these numbers using any in-place sorting that takes
O(n) time,
Does there exist any such sorting algo.???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to