I am trying to represent AVL's in an old way that I was taught and found more intuitive to display in comparison to most common books nowadays. The raw images with the features I am interested in are shown below from the Niklaus Wirth 1986 book and some hand written notes.
While the visualization may be specific, representing AVLs is a general data structures concept of computer science, and the intention is actually to use such drawings for lecture notes. So I believe it can be useful to a wider audience.
From this one (the book) I am trying to get exactly what it is shown: Some nodes as circles
, some as long vertical rectangles
, with dashed lines highlighting the bottom part of the tree, and one single node with an X indicating the node of removal. Some rectangles stay above, within and below as shown in the figure. I have been trying to try representing the dashed lines as some sort of tikz node and position accordingly but no luck.
From the hand written notes, I am trying to get numbers around the nodes (-2, -1, h-1, etc)
, letters 'A,B,C,D' on the rectangles, and the circle oriented arrows to indicate rotation direction
.
I was able to find ways to represent numbers around another question as well try to represent parts of the tree with triangle shapes but modifying their minimal examples to what I want has been particularly challenging.