We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d8d0b8 commit dedde40Copy full SHA for dedde40
src/_Searching_/TernarySearch/index.js
@@ -1,6 +1,11 @@
1
/**
2
* Note: Array must be sorted for binary search
3
- */
+ * Complexity:
4
+ * Worst case time complexity: O(log N)
5
+ * Average case time complexity: O(log N)
6
+ * Best case time complexity: O(1)
7
+ * Space complexity: O(1)
8
+*/
9
function ternarySearch(arr, key){
10
let left = 0;
11
let right = arr.length - 1;
0 commit comments