New to AVL tree implementation.
- by nn
I am writing a sliding window compression algorithm (LZ77) that searches for phrases in a "moving" dictionary.
So far I have written a BST where each node is stored in an array and it's index in the array is also the value of the starting position in the window itself.
I am now looking at transforming the BST to an AVL tree. I am a little confused at the sample implementations I have seen. Some only appear to store the balance factors whereas others store the height of each tree.
Are there any performance advantage/disadvantages of storing the height and/or balance factor for each node? Apologies if this is a very simple question, but I'm still not visualizing how I want to restructure my BST to implement height balancing.
Thanks.