Menu

[r376]: / XSORT.MPL  Maximize  Restore  History

Download this file

20 lines (12 with data), 327 Bytes

/*
  EXAMPLE OF QUICKSORT IN MPL - ALGORITHM BASED ON ROSETTACODE
*/

##LIBHDR

INTCMP(A,B) A-B

VECSORT(D,L) QSORT(D,D!(L-1)$,INTCMP)

.SIZE:10 .DATA=10,9,8,7,6,5,4,3,2,1

.(;I) [
  I=0; I<.SIZE @ WRITED(.DATA!I++,3); NEWLINE();
  VECSORT(.DATA,.SIZE);
  I=0; I<.SIZE @ WRITED(.DATA!I++,3); NEWLINE();
0]

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.