Note that this method returns a single integer. You will need to extend the AVL tree data structure, adding a new field to each internal node and the ways of maintaining this field during updates.