[algogeeks] Required O(n) Algorithm

2012-04-18 Thread VIHARRI
Can anybody give an O(n) algorithm for the following problem. Suppose if we have an array, I would like to construct an array with the elements which specify their corresponding position in the sorted array. For example if the array is { 0.87, 0.04, 0.95, 0.12, 0.36 } then the sorted array

Re: [algogeeks] Required O(n) Algorithm

2012-04-18 Thread Rahul Kumar Patle
use counting sort.. it gives linear time complexity... first step of counting sort is the same as you have mentioned in question... On Wed, Apr 18, 2012 at 6:37 PM, VIHARRI viharri@gmail.com wrote: Can anybody give an O(n) algorithm for the following problem. Suppose if we have an array,

Re: [algogeeks] Required O(n) Algorithm

2012-04-18 Thread Dave
@Rahul: Please explain how you are going to use a counting sort with the original poster's data. Dave On Wednesday, April 18, 2012 8:12:41 AM UTC-5, Rahul Kumar Patle wrote: use counting sort.. it gives linear time complexity... first step of counting sort is the same as you have

Re: Re: [algogeeks] Required O(n) Algorithm

2012-04-18 Thread viharri . plv
Yeah we cant use count sort, as we dont know the range of elements here... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to