emory-courses / dsa-java

Data Structures and Algorithms in Java
https://emory.gitbook.io/dsa-java/
42 stars 55 forks source link

[QZ#4] Input structure #115

Closed lcunild closed 4 years ago

lcunild commented 4 years ago

Are we assuming that the tree was balanced before the red key was added (i.e. the Uncle's child cannot have any children, else the height would differ by more than 1 so be unbalanced)?

lujiaying commented 4 years ago

I am waiting for Dr. Choi's response. I will reach back immediately once I know the answer.

lujiaying commented 4 years ago

From my understanding, the BalacnedBinarySearchTreeQuiz inherits AbstractBalancedBinarySearchTree class. So please assume that before balance(), the tree instance is already balanced.

lujiaying commented 4 years ago

Also, please take a look at https://github.com/emory-courses/dsa-java/issues/106 When conds not met, no need to conduct balance.