CS251 AVL Tree
Requirement
Implement a C++ AVL Tree class AVLTree in files AVLTree.h and AVLTree.cpp
1. The constructor AVLTree () builds the AVLTree.
2. The destructor ~AVLTree() deallocates all dynamically allocated memory.
3. The void insert(int k) method inserts the key k into the AVLTree, and does not do anything if the key is already stored.
4. The void remove(int k) method removes key k from the AVLTree and does not do anything if AVLTree does not contain key k.
5. The items stored are positive integers which serve both as keys and as elements.
6. The void printInorder() method prints the tree to the standard output using an inorder traversal; it prints a (key, height) pair for each node and ends with a newline.
7. The void printPostorder() method prints the tree to the standard output using postorder traversal; it prints a (key, height) pair for each node and ends with a newline.
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。