Re: Fast appending and sorting of alot of short strings
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Oct 09, 2004
- 498 views
On Fri, 8 Oct 2004 22:56:04 -0500, Kat <gertie at visionsix.com> wrote: >> table[current+1..tabused]=table[current..tabused-1] > >But you are dropping the last tabused element of table, aren't you? Perhaps. I should have coded tabused+=1 immediately before the above statement, to make it clearer. It also depends on how you calculate "current", eg inserting 4 into {1,3,5,7}, is current 2 or 3? If a binary search fails, I'm not sure which it would return. Perhaps it would be wise to test and add 1 just in case. To be honest, I've only used this technique to remove chunks of a table, and usually shifting relatively small blocks about near the end of the table, which may have exaggerated the benefits I experienced (vs. "&"). > Or is it spare space preappended to table? Yes, the intention is that table[tabused+1..length(tabused)] is unused, and that before the above if tabused=length(tabused) you append additional spare space. Regards, Pete