Binary tree & Binary search tree

whitehousechef·2025년 4월 8일

So diff between binary tree and bst is bst's inorder is in ascending order (i.e. root's left is always smaller than root and root is always smaller than root.right)

This is useful in https://velog.io/@whitehousechef/Leetcode-530.-Minimum-Absolute-Difference-in-BST.

complexity

very impt, even when just store constants in local variables, if we use recursion, the space depends on the call stack.
So if balanced, log n and if skewed, it is n space.

0개의 댓글