Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Computer science degree and Foxpro
Message
From
25/07/1999 23:38:39
 
 
To
25/07/1999 13:38:09
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00243740
Message ID:
00245945
Views:
17
Yes, but the source array is in very special case. Basically, the same result is obtained with:

for i = 1 to n
result[i]=i
endfor

I mean: the algorithm doesn't sort the source array. It's only a complicated way of doing something very simple... :)

Vlad

>Hey Paul.
>
>source[1]=10
>source[2]=5
>source[3]=8
>source[4]=1
>source[5]=9
>source[6]=2
>source[7]=6
>source[8]=7
>source[9]=3
>source[10]=4
>
>for i=1 to 10
> sorted[source[i]] = source[i]
>endfor
>
>so sorted[10] becomes the value of source[1] and sorted[5] gets the value of source[2] etc.
>
>What is amazing about this branch of this topic is the semantics. The code takes an unsorted list of numbers and produced a sorted list of numbers. It does this with only one pass through the source list. Its not possible to argue that this is not the fastest possible sort (unless your a lawyer).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform