quoted from wiki
"While selection sort is preferable to insertion sort in terms of number of
writes (Θ(*n*) swaps versus Ο(*n*2) swaps), it almost always far exceeds
(and never beats) the number of writes that cycle
sort<http://en.wikipedia.org/wiki/Cycle_sort>makes, as cycle sort is
theoretically optimal in the number of writes. This
can be important if writes are significantly more expensive than reads,
such as with EEPROM <http://en.wikipedia.org/wiki/EEPROM> or
Flash<http://en.wikipedia.org/wiki/Flash_memory>memory, where every
write lessens the lifespan of the memory."

so i think answer for the second will be cycle sort


--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
 <http://gplus.to/amolsharma99>
<http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99>





On Mon, Nov 21, 2011 at 12:15 PM, Ankur Garg <ankurga...@gmail.com> wrote:

> I think Merge Sort doesnt require any swapping . So , for 3 my answer wud
> be Merge Sort
>
> On Mon, Nov 21, 2011 at 11:55 AM, Dave <dave_and_da...@juno.com> wrote:
>
>> @Kumar: For question 1, the answer is radix sort. It doesn't use data
>> comparisons at all.
>>
>> Dave
>>
>> On Nov 21, 12:04 am, kumar raja <rajkumar.cs...@gmail.com> wrote:
>> > if we have set of n elements then
>> >
>> > 1) which sorting method uses least number of comparisons??
>> >
>> > 2) which sorting method uses least number of swaps??
>> >
>> > 3) suppose the array is 2 8 4 6 5 9
>> > if we want to swap 8  and 5 the cost is 2(5-2)=6   .here 5 and 2 are
>> > indices of 5 and 8.
>> > so what sorting method minimizes the cost, i want the answer in general
>> > case ,not for this particular array. it is also called least distance
>> > sorting
>> >
>> > --
>> > Regards
>> > Kumar Raja
>> > M.Tech(SIT)
>> > IIT Kharagpur,
>> > 10it60...@iitkgp.ac.in
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

-- 
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.

Reply via email to