Hey, maybe someone have Timsort implementation in Delphi?

Hey, maybe someone have Timsort implementation in Delphi?
http://en.wikipedia.org/wiki/Timsort

Comments

  1. This would be interesting, if there would be good implementation on this...

    ReplyDelete
  2. Shell's sort is a good alternative as it doesn't degrade in performance like QuickSort if the result set is partially or fully sorted.

    ReplyDelete
  3. More stability to sort can be added with compare function I made something like this :

    if a.x = b.x then
      Result := CompareObjectPointerValues(a, b);

    So as last resort I compared the Raw pointers of the objects, and they  should always be different (if the implementation will not use duplicate objects references)

    ReplyDelete
  4. Simon Stuart I would be very grateful for this.

    ReplyDelete
  5. Been using merge sort for a while, which seems to hold its own against timsort: http://gamasutra.com/view/news/172542/Indepth_Smoothsort_vs_Timsort.php#.URsHjBG9KSM
    I'm not convinced being fast on already sorted arrays is such a great advantage, usually that's handled by flagging, on partially sorted arrays, timsort & merge sort are similar, and on random arrays timsort is worse. So not convinced the greater complexity (and potential for bugs) of timsort is really worth it.

    ReplyDelete

Post a Comment