Author Topic: Fast stable integer sort  (Read 8816 times)

jj2007

  • Member
  • *****
  • Posts: 11135
  • Assembler is fun ;-)
    • MasmBasic
Re: Fast stable integer sort
« Reply #15 on: May 28, 2014, 10:59:18 PM »
MasmBasic stable string sort is online - see http://masm32.com/board/index.php?topic=3231.0

Cheers, JJ

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: Fast stable integer sort
« Reply #16 on: May 29, 2014, 05:58:58 AM »
Jochen,
Quote
Your merge sort is very fast indeed (but unfortunately not suitable for my purpose of string sorting

What about to write a procedure (or ?) to generate random strings of any length between LenMin to LenMax ? Do you know something about it ?

jj2007

  • Member
  • *****
  • Posts: 11135
  • Assembler is fun ;-)
    • MasmBasic
Re: Fast stable integer sort
« Reply #17 on: May 29, 2014, 06:14:38 AM »
What about to write a procedure (or ?) to generate random strings of any length between LenMin to LenMax ? Do you know something about it ?

I can offer Scramble:

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  Recall "\Masm32\include\Windows.inc", L$()
  push eax
  NanoTimer()
  xor ecx, ecx
  .Repeat
      Scramble L$()      ; un-sort the array
      QSort L$()
      Scramble L$()      ; un-sort the array
      QSortDesc L$()
      inc ecx
  .Until ecx>=50
  pop ecx
  Inkey Str$("Sorting 100 x %i lines", ecx), Str$(" took %i ms", NanoTimer(ms))
  Exit
end start


Output:
Sorting 100 x 26902 lines took 2518 ms