I'm reading the chapter Radix Search of the book Algorithms (Robert Sedgwick).
I've made a simple implementation and something isn't behaving as expected.
In program 15.5 you can see that we start with an empty tree where the head is a null node. In figure 15.12 you can see that the null node is always the leftmost node. This is also described in the text:
We use the convention that the leftmost link (the one correspond- ing to a key that is all 0 bits) does not point to any internal node
program 15.7 is the implementation of Patricia-trie insertion.
If you look at the code, there's never a chance for the head reference to change, let's say, to A as depicted in figure 15.12.
Is this a bug?