Skip to main content

QUICKSORT

Syntax


SUB QUICKSORT( buffer, number_of_elements )

Description


QUICKSORT is built into version 8.30 and later.

This version of QuickSort, will sort number_of_elements integers in buffer.\

Example

\

#define MAX_NUMBERS
100

dim
numbers(MAX_NUMBERS) ' BASIC arrays have elements 0 to MAX_NUMBERS
for i=0 to MAX_NUMBERS
numbers (i)=MAX_NUMBERS-i
next
for i= 0to 10
print numbers(i)
next
print
print "now sort the numbers"
quicksort(addressof numbers, MAX_NUMBERS+1)
for i=0 to 10
print numbers(i)

next

\

Differences from other BASICs

\

  • no equivalent Visual BASIC
  • no equivalent in PBASIC

See also

\