Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
*
* Solution 1: Brute Force Solution: Do an inorder traversal and save result
* into an array. Iterate over the array to get an element equal to or greater
* than current key. Time Complexity: O(n) Space Complexity: O(n) for auxillary
* than current key. Time Complexity: O(n) Space Complexity: O(n) for auxiliary
* array to save inorder representation of tree.
* <p>
* <p>
* Solution 2: Brute Force Solution: Do an inorder traversal and save result
* into an array.Since array is sorted do a binary search over the array to get
* an element equal to or greater than current key. Time Complexity: O(n) for
* traversal of tree and O(lg(n)) for binary search in array. Total = O(n) Space
* Complexity: O(n) for auxillary array to save inorder representation of tree.
* Complexity: O(n) for auxiliary array to save inorder representation of tree.
* <p>
* <p>
* Solution 3: Optimal We can do a DFS search on given tree in following
Expand Down