emory-courses / dsa-java

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

[QZ#4] Confused on the logic given. #116

Closed JonathanKimchi closed 3 years ago

JonathanKimchi commented 3 years ago

This question builds on the previous questions asked for this quiz.

So the expected output is a balanced tree. Say we get these trees as inputs:

Tree Test

This is what we were given as a logic map from Dr. Choi:

Override the balance() method that first checks the following conditions: node is the only child & node’s parent is the right child of node's grand parent & node’s uncle has only one child.

Correct me if I'm wrong, but based off of the ruleset in the logic map given to us, the second input wouldn't execute any rotations. This would leave the tree unbalanced, wouldn't it?

lujiaying commented 3 years ago

Either of the three input trees is balanced. So I assume that I would not add such test cases.

JonathanKimchi commented 3 years ago

Okay, thank you. I will move forward with the understanding that the three trees listed are considered to be balanced for the criteria of this quiz.

lujiaying commented 3 years ago

Please take a look at : https://github.com/emory-courses/dsa-java/issues/117