Skip to content

Commit 97a9cca

Browse files
authored
Merge pull request #1164 from jxu/patch-12
Ternary search: minor fix time complexity
2 parents 2044a99 + 66609ba commit 97a9cca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/num_methods/ternary_search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ If $m_1$ and $m_2$ are chosen to be closer to each other, the convergence rate w
4545

4646
### Run time analysis
4747

48-
$$T(n) = T({2n}/{3}) + 1 = \Theta(\log n)$$
48+
$$T(n) = T({2n}/{3}) + O(1) = \Theta(\log n)$$
4949

5050
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.
5151

0 commit comments

Comments
 (0)