>- All gentleman code was based on brute force, on wich every iteration of the algorithm caused equal or more work in each step. In example, Tore's algorithm read all the info in a table and uses the SQL engine to order it, while Dragan's algorithm uses a variable on which in every iteration is bigger and the search of subtsr is longer
The size of the variable won't exceed 256 bytes. But everything else is as you said - well, I wrote this off the top of my head, a quick fix for the case you don't get anything better. Didn't even try it out.
Such things are frequently put in place and not fixed unless critical. Saving a few milliseconds here and there is nice, if the total saved time for a year is larger than the time you spent making it faster.