On 11 Jul 2005 at 13:37, Contestcen@aol.com wrote:
[...]
Conclusion: If the strings are known at compile time, the most efficient way to store them without gaps is to use the Pascal Macro Compiler.
A very bold claim indeed - and I am not sure how you can make such a claim, without seeing every string-handling routine that every programmer has written.
If the strings are not known until run time, the most efficient way is to allocate a large block of storage, and move the strings in end-to-end, using a separate array to hold either pointers or indices into the large block.
When the block is full, allocate another large block using New. There are two ways to manage the storage. (1) Extension block method: Use a second array to point to the set of large blocks. Each string will be accessed using two pointers or two indices. The first will point to the particular block, and the second will point to the string within the block. (2) Single block method: Make the new block twice as large as the previous block, move the existing strings into the new block and then Dispose the old block.
Very convoluted. A linked list or string collection would do just fine. And I am still not sure how you can make the claim that one method or the other is the "most efficient" way of doing something.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/