aalhour / C-Sharp-Algorithms

:books: :chart_with_upwards_trend: Plug-and-play class-library project of standard Data Structures and Algorithms in C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AVLTreeTest failing - Case 5 (delete root of AVL tree)

gregfra opened this issue · comments

Case 5 -- could this be a test verification failure?
Xunit.Sdk.TrueException: 'Wrong root.
Expected: True
Actual: False'

Assert.True(avlRoot.Value == 6, "Wrong root.");

The code seems to produce the tree of 5 at L1, 2 and 6 are children of 5 (L2), 1 and 3 are children of 2 (L2), 7 is right child of 6 (L2). This is a valid BST and AVL tree.

The final (expected) tree mentioned in the comments (lines 119-127) is not a proper BST.

Suggest changing the assertions or updating case #5 to set up a tree that does require rebalancing after root node deletion. I can make the change and submit a PR from here.