You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/num_methods/ternary_search.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ If $m_1$ and $m_2$ are chosen to be closer to each other, the convergence rate w
45
45
46
46
### Run time analysis
47
47
48
-
$$T(n) = T({2n}/{3}) + 1 = \Theta(\log n)$$
48
+
$$T(n) = T({2n}/{3}) + O(1) = \Theta(\log n)$$
49
49
50
50
It can be visualized as follows: every time after evaluating the function at points $m_1$ and $m_2$, we are essentially ignoring about one third of the interval, either the left or right one. Thus the size of the search space is ${2n}/{3}$ of the original one.
0 commit comments