Homework 05: AVL Tree Traversal Solution






Submit your answer to this question via PC^2 under your account by the posted due time. No late submissions will be accepted. Note that homework is opened-book, but no outside assistance is permitted.




An AVL tree is another balanced binary search tree. Named after their inventors, Adelson-Velskii and Landis, they were the first dynamically balanced trees to be proposed. Like red-black trees, they are not perfectly balanced, but pairs of sub-trees differ in height by at most 1, maintaining an O(logn) search time.


Write a program that returns the in-order traversal of the AVL tree nodes’ values.


Sample input





Sample output


Inorder traversal: [11, 20, 23, 26, 29, 41, 50, 65]

error: Content is protected !!