Skip to content

Commit 1f44da7

Browse files
committed
Added some time and space complexity to readme
1 parent 19637ee commit 1f44da7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
- Keys in the right subtree of a node are larger than the node’s key.
1717
- Duplicate keys are not allowed.
1818

19+
Time Complexity:
20+
Search, Insert, Delete:
21+
- Average Case: O(log n) => This occurs when the BST is balanced.
22+
- Worst Case: O(n) => This occurs when the BST is skewed.
23+
24+
Space Complexity:
25+
- Space for the BST: O(n).
26+
- Recursive Operations: O(h), where h is the height of the tree.
27+
1928
**Methods**
2029
- **`insert(key)`**:
2130
- Inserts a specified key into the Binary Search Tree (BST) while maintaining BST properties.

0 commit comments

Comments
 (0)