3 ms·
Not really a useful problem, considering that it will be impossible to solve if the tree would be properly balanced.
by amelius 9y ago
Not really a useful problem, considering that it will be impossible to solve if the tree would be properly balanced.
- junke 9y agoWhat do you mean?
- sigjuice 9y agoI think it is irrelevant whether the binary search tree is balanced or not. Why do you think it matters?
- mbrumlow 9y agoI don't agree. The tree being balanced of not has not bearing on the solvability of the problem. Even a naive approach would work balanced or unbalanced and that would be simply to pop the lowest value in the tree and construct your list until you run out of nodes. The trick is to do it in O(n) time and use recursion.