An example is given in the AVLTreeStructureTest class in the dsa.example package. This performs some operations (only insert) on an AVL tree. To check if the final AVL tree is correct, it compares it with a Binary Search Tree that has the final expected shape (I worked this out manuall...
#include<iostream> #include<queue> using namespace std; typedef struct node * tree; struct node { int data; tree left; tree right; }; int getheight(tree t) { if (!t)return 0; int l = getheight(t->left) + 1; int r = getheight(t->right) + 1; return l > r ? l : r;...
An example is given in the AVLTreeStructureTest class in the dsa.example package. This performs some operations (only insert) on an AVL tree. To check if the final AVL tree is correct, it compares it with a Binary Search Tree that has the final expected shape (I worked this out manuall...