Skip to content

Commit

Permalink
Added some time and space complexity to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert0011 committed Feb 2, 2025
1 parent 19637ee commit 1f44da7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
- Keys in the right subtree of a node are larger than the node’s key.
- Duplicate keys are not allowed.

Time Complexity:
Search, Insert, Delete:
- Average Case: O(log n) => This occurs when the BST is balanced.
- Worst Case: O(n) => This occurs when the BST is skewed.

Space Complexity:
- Space for the BST: O(n).
- Recursive Operations: O(h), where h is the height of the tree.

**Methods**
- **`insert(key)`**:
- Inserts a specified key into the Binary Search Tree (BST) while maintaining BST properties.
Expand Down

0 comments on commit 1f44da7

Please sign in to comment.