#include <assert.h>
), together with suitable printf()
debugging, have proven as an invaluable tool during the process.The code is after the purely textual description of the BTree data structure in Knuth's volume 3. There he says that "removal is only slightly more complicated than insertion". That might (actually, is) so on a conceptual level. But, when translated into code: aroud 4x more code, around that much more time and a number of corner-cases.
I've run the code through valgrind and I have no errors. Wow! :)
Tags: TAOCP algorithms Knuth