From 66609ba5ee72de3478f50e43d9a7148ae4bdb5da Mon Sep 17 00:00:00 2001 From: jxu <7989982+jxu@users.noreply.github.com> Date: Sat, 14 Oct 2023 01:00:02 -0400 Subject: [PATCH] Ternary search: minor fix time complexity --- src/num_methods/ternary_search.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/num_methods/ternary_search.md b/src/num_methods/ternary_search.md index 0d13ec0db..373c47142 100644 --- a/src/num_methods/ternary_search.md +++ b/src/num_methods/ternary_search.md @@ -45,7 +45,7 @@ If $m_1$ and $m_2$ are chosen to be closer to each other, the convergence rate w ### Run time analysis -$$T(n) = T({2n}/{3}) + 1 = \Theta(\log n)$$ +$$T(n) = T({2n}/{3}) + O(1) = \Theta(\log n)$$ 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.