Re: [algogeeks] Re: Soritng

2011-11-21 Thread kumar raja
@Dave: let us leave about Radix sort ,for it there are specific constraints
on the numbers.

@Amol sharma: i dont know what is cycle sort? Convey your answer in well
known sorting methods.

Ankur garg:In the phase of merging it compares the sorted sub arrays to
merge them .So it is not correct..

On 20 November 2011 22:56, Amol Sharma amolsharm...@gmail.com wrote:

 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 
 sorthttp://en.wikipedia.org/wiki/Cycle_sortmakes, 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 
 Flashhttp://en.wikipedia.org/wiki/Flash_memorymemory, 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/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://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.




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



[algogeeks] Re: Soritng

2011-11-20 Thread Dave
@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.



Re: [algogeeks] Re: Soritng

2011-11-20 Thread Ankur Garg
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.



Re: [algogeeks] Re: Soritng

2011-11-20 Thread Amol Sharma
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
sorthttp://en.wikipedia.org/wiki/Cycle_sortmakes, 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
Flashhttp://en.wikipedia.org/wiki/Flash_memorymemory, 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/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://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.