Editing Ternary search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 32: | Line 32: | ||
The loop runs about <math>\log_{3/2}\frac{b-a}{\epsilon}</math> times, since each iteration reduces the length of the interval <math>[l,r]</math> by a factor of <math>\frac{3}{2}</math>. Each iteration involves two evaluations of the function, so the total number of evaluations is about <math>2\log_{3/2}\frac{b-a}{\epsilon}</math>. This is <math>\Theta\left(\log(b-a) + \log\frac{1}{\epsilon}\right)</math>, so the smaller the epsilon, the longer the search takes, but overall the time is logarithmic in the length of the initial interval. | The loop runs about <math>\log_{3/2}\frac{b-a}{\epsilon}</math> times, since each iteration reduces the length of the interval <math>[l,r]</math> by a factor of <math>\frac{3}{2}</math>. Each iteration involves two evaluations of the function, so the total number of evaluations is about <math>2\log_{3/2}\frac{b-a}{\epsilon}</math>. This is <math>\Theta\left(\log(b-a) + \log\frac{1}{\epsilon}\right)</math>, so the smaller the epsilon, the longer the search takes, but overall the time is logarithmic in the length of the initial interval. | ||
− | + | [[Category:Pages needing example problems]] |