Changed BST's worst run-time from O(log n) to O(n) (#31445)

This commit is contained in:
Jacob Kim
2019-05-17 09:44:45 +09:00
committed by Christopher McCormack
parent 5964e764da
commit 93214303d4

View File

@ -66,13 +66,14 @@ Successors can be described as the node that would come right after the the curr
- Trie (Radix tree)
### Runtime
**Data structure: Array**
- Worst-case performance: `O(log n)`
**Data structure: BST**
- Worst-case performance: `O(n)`
- Best-case performance: `O(1)`
- Average performance: `O(log n)`
- Worst-case space complexity: `O(1)`
Where `n` is the number of nodes in the BST.
Worst case is O(n) since BST can be unbalanced.
### Implementation of BST