Hi Alex, > A typical example would be sorting a list of customers by city, name and > customer number, in that order. A binary comparison for 'sort2' would > look like > > (sort2 > (collect ... '+CuSu ...) > '((CuSu1 CuSu2) > (cond > ((<> (; CuSu1 ort) (; CuSu2 ort)) > (> (; CuSu2 ort) (; CuSu1 ort)) ) > ((<> (; CuSu1 nm) (; CuSu2 nm)) > (> (; CuSu2 nm) (; CuSu1 nm)) ) > (T > (> (; CuSu2 nr) (; CuSu1 nr)) ) ) ) ) > > This binary function is rather complicated (and thus slow), and it might > be called nearly O(N^2) times.
it should be called O(N*log(N)) times if the built-in 'sort' function implements a decent sorting algorithm (which I guess it does;-). Cheers, Tomas -- UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe
