Open jeff1evesque opened 10 years ago
cb57940: regardless whether the first value is greater than the second inputted LCA value, the above error has been eliminated:
MacBook-Pro-15:least-common-ancestor jeffrey$ python least_common_ancestor.py
Would you like to enter values?
y
Enter tree value (q - to quit): 23
Enter tree value (q - to quit): 45
Enter tree value (q - to quit): 67
Enter tree value (q - to quit): 98
Enter tree value (q - to quit): 8
Enter tree value (q - to quit): 5
Enter tree value (q - to quit): 3
Enter tree value (q - to quit): 1
Enter tree value (q - to quit): q
Enter the first LCA node value: 67
Enter the second LCA node value: 8
1.0
2.0
3.0
5.0
8.0
45.0
67.0
98.0
('least common ancestor: ', 45.0)
If users first LCA node value is greater than the second inputed value, we get an error of the following:
If, however, we input the first LCA node value less than the second, it works fine: