Jump to content

Talk:Ternary search

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Untitled

[edit]

I reverted the algorithm to the last 2010 version.

- The feb.2011 algorithm doesn't actually search a maximum of a function
- It is not even correct for what it seems it is doing, namely search an element k in an array.

So it was irrelevant and wrong. -- Florian Fischer —Preceding unsigned comment added by 129.195.0.205 (talk) 09:27, 15 April 2011 (UTC)[reply]

I'm reacting to the version by Shreevatsa.

Consider the sequence {3, 3, 3, 3, 3, 3, 3, 1000, 3}. It satisfies your definition of a unimodal sequence, but your algorithm fails to find the minimum. (Here, it's the definition that's wrong, you need the sequence to be strictly increasing/decreasing.)

Also, your constraints fail to mention f(x), thus this: {10, 20, 30, 40, -10000, 40, 30, 20, 10} satisfies them.

And the article is IMHO fundamentally misleading. For sequences there are better algorithms, such as: look at the elements x=floor((left+right)/2) and x+1. Ternary search is used for functions, because it is simple to code and numerically stable.

-- misof

Changed to functions, removed unimodal and monotonic references. --Enogipe

Well, there are also better algorithms for functions: If one uses the golden ratio instead of thirds, the interval size shrinks to 0.618... instead of 0.666... and one can reuse expensively calculated function values (one function evaluation instead of two per iteration). -- hagman

One-third and one-third and two-thirds makes four-thirds which is greater than one...

-- silentOpen

I think that the pseudocode needs some explanation, because I myself have no idea what the absolutePrecision variable means. For people not familiar with this kind of pseudocode it would be a big help. --Xlegendarylinkx (talk) 19:12, 17 April 2008 (UTC)[reply]

India Education Program course assignment

[edit]

This article was the subject of an educational assignment at College Of Engineering Pune supported by Wikipedia Ambassadors through the India Education Program during the 2011 Q3 term. Further details are available on the course page.

The above message was substituted from {{IEP assignment}} by PrimeBOT (talk) on 20:01, 1 February 2023 (UTC)[reply]