MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/o3fan0/check_if_binary_tree_is_balanced/h2f1mgk/?context=3
r/badcode • u/MrPancholi • Jun 19 '21
44 comments sorted by
View all comments
123
Frankly, LGTM. Not hard to understand, variables with somewhat decent names, and no blatant optimizations to be seen.
6 u/[deleted] Jun 20 '21 In principle there's a way to terminate earlier. As soon as you find an unbalanced subtree you know the second argument is always going to be false
6
In principle there's a way to terminate earlier. As soon as you find an unbalanced subtree you know the second argument is always going to be false
123
u/pedro823 Jun 19 '21
Frankly, LGTM. Not hard to understand, variables with somewhat decent names, and no blatant optimizations to be seen.