posted 13 years ago
What I did when I had that problem was to just keep the nodes in alphabetic order from the beginning. When I added a node, I just went down the list until I found something later in the alphabet than the new node, and added the new node before it. Or added the new node at the end, if I didn't find something. And for changed nodes, you simply remove the node from the list and add it back, using the same procedure of course.