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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 mentioned in 
> question...
>
>
> On Wed, Apr 18, 2012 at 6:37 PM, VIHARRI  wrote:
>
>> 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 would be { 0.04, 0.12, 0.36, 0.87, 0.95 }.
>> Then output array would be {3, 0, 4, 1, 2 }.
>>
>> Hope I'm clear...
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/algogeeks/-/NH1P0aIguFEJ.
>> To post to this group, send email to algogeeks@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.
>>
>
>
>
> -- 
> Thanks and Regards:
> Rahul Kumar Patle
> M.Tech, School of Information Technology
> Indian Institute of Technology, Kharagpur-721302, India
> Mobile No: +91-8798049298, +91-9424738542
> patlerahulku...@gmail.com
> rahulkumarpa...@yahoo.com
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/yeTCwQ-WsOwJ.
To post to this group, send email to algogeeks@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.



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  wrote:

> 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 would be { 0.04, 0.12, 0.36, 0.87, 0.95 }.
> Then output array would be {3, 0, 4, 1, 2 }.
>
> Hope I'm clear...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/NH1P0aIguFEJ.
> To post to this group, send email to algogeeks@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.
>



-- 
Thanks and Regards:
Rahul Kumar Patle
M.Tech, School of Information Technology
Indian Institute of Technology, Kharagpur-721302, India
Mobile No: +91-8798049298, +91-9424738542
patlerahulku...@gmail.com
rahulkumarpa...@yahoo.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 would be { 0.04, 0.12, 0.36, 0.87, 0.95 }.
Then output array would be {3, 0, 4, 1, 2 }.

Hope I'm clear...

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/NH1P0aIguFEJ.
To post to this group, send email to algogeeks@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.