Saturday, October 15, 2005

[VBScript] sorting algorithms

Thanks to Dr Hans Werner Lang for his helpful comments on the sorting routines, as below:
Hi,
but there is no need to rewrite the outer loop, is it?
    for i=h to n-1
    ...

The inner loop, with the problem of the conditional And, could be written as
    do while j>=h
        if a(j-h)<=t then exit do
        ...
    loop

In my opinion, exit do should be avoided (when possible).

Regards
H.W. Lang
I've made the changes to the class as suggested but haven't posted them as yet.

No comments: