News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Fast stable integer sort

Started by jj2007, May 14, 2014, 12:56:57 AM

Previous topic - Next topic

jj2007

MasmBasic stable string sort is online - see http://masm32.com/board/index.php?topic=3231.0

Cheers, JJ

RuiLoureiro

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

Quote from: RuiLoureiro on May 29, 2014, 05:58:58 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