Quote:
~ $ gcc -std=c99 -march=native -Wall -pedantic array.c -o array
~ $ gcc -std=c99 -march=native -Wall -pedantic btree.c -o btree
~ $ time ./array < test > tsta
real 0m5.601s
user 0m5.111s
sys 0m0.210s
~ $ time ./btree < test > tstb
real 0m3.616s
user 0m3.197s
sys 0m0.289s
~ $ diff tsta tstb
~ $ time ./array < test > /dev/null
real 0m5.154s
user 0m5.025s
sys 0m0.117s
~ $ time ./btree < test > /dev/null
real 0m3.369s
user 0m3.200s
sys 0m0.163s
Note that those were compiled without optimisations, and the file test is basically just the plaintext version of the C89 standard catted 360 times (5,129,640 lines, with each line < 80 characters.) The array version has shorter and perhaps simpler code, but it comes at the price of a fixed maximum number of lines. The times made by both programs are fairly good, at least in comparison with other methods, but I'd still say that a binary tree is the most practical choice in this case for its ease of implementation, insertion, and speed.