MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/o3fan0/check_if_binary_tree_is_balanced/h2dbs9w/?context=3
r/badcode • u/MrPancholi • Jun 19 '21
44 comments sorted by
View all comments
137
What is bad about this? Looks pretty readable to me, good variable names (all though perhaps a bit verbose), and it's pretty much just the standard O(n) algorithm
www.geeksforgeeks.org/how-to-determine-if-a-binary-tree-is-balanced
-55 u/MrPancholi Jun 19 '21 It does work, but I just thought that the tuple thing I did was a little weird.I suck with algorithms so I though this was pretty far form the ideal solution. 3 u/btwiusearch Jun 19 '21 getHeightBalanceTuplThe weird thing is that the e is missing.
-55
It does work, but I just thought that the tuple thing I did was a little weird.
I suck with algorithms so I though this was pretty far form the ideal solution.
3 u/btwiusearch Jun 19 '21 getHeightBalanceTuplThe weird thing is that the e is missing.
3
getHeightBalanceTupl
The weird thing is that the e is missing.
137
u/SuperSmurfen Jun 19 '21 edited Jun 19 '21
What is bad about this? Looks pretty readable to me, good variable names (all though perhaps a bit verbose), and it's pretty much just the standard O(n) algorithm
www.geeksforgeeks.org/how-to-determine-if-a-binary-tree-is-balanced