Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sorting Algorithms
#10
What I don't understand about insertion sort, as presented in the original link, is...

Why go back in descending order? Would it not be faster to cut the sorted in half every time by comparing it to the middle element, using log(sorted) instead of linear(sorted) time?


I guess it's a data structure thing? If your sorted data's in a simple array, you need to move all the elements anyway. But if it's in something different where insertion's O(1) then using a log time to find the point seems better.
Reply


Messages In This Thread
Sorting Algorithms - by Cyadd - 2010-10-20, 10:01 PM
Sorting Algorithms - by Hazzy - 2010-10-20, 10:12 PM
Sorting Algorithms - by Russt - 2010-10-20, 10:55 PM
Sorting Algorithms - by Loose - 2010-10-20, 11:03 PM
Sorting Algorithms - by Fiel - 2010-10-20, 11:17 PM
Sorting Algorithms - by Cyadd - 2010-10-21, 12:04 AM
Sorting Algorithms - by Spaz - 2010-10-21, 02:10 PM
Sorting Algorithms - by Nikkey - 2010-10-21, 09:09 PM
Sorting Algorithms - by Russt - 2010-10-21, 11:46 PM
Sorting Algorithms - by Stereo - 2010-10-22, 12:28 AM
Sorting Algorithms - by Russt - 2010-10-22, 12:43 AM
Sorting Algorithms - by Nikkey - 2010-10-22, 06:32 AM
Sorting Algorithms - by Stereo - 2010-10-22, 01:34 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)