File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
src/test/java/com/thealgorithms/tree/AVLtree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 11package com .thealgorithms .tree .AVLtree ;
22
3-
4-
5- ;
6-
73public class CheckBalance extends AVLInsert {
84
95 boolean isBalanced (Node node ) {
@@ -24,10 +20,13 @@ public static void main(String[] args) {
2420 tree .root = tree .insert (tree .root , 10 );
2521 tree .root = tree .insert (tree .root , 20 );
2622 tree .root = tree .insert (tree .root , 30 );
23+ tree .root = tree .insert (tree .root , 40 );
24+ tree .root = tree .insert (tree .root , 50 );
25+ tree .root = tree .insert (tree .root , 25 );
2726
2827 System .out .println ("Is AVL Tree balanced? " + tree .isBalanced (tree .root ));
2928
30- // Manually unbalance the tree
29+ // Manually unbalance it
3130 tree .root .left .left = new Node (5 );
3231 System .out .println ("Is AVL Tree balanced after modification? " + tree .isBalanced (tree .root ));
3332 }
You can’t perform that action at this time.
0 commit comments