Ternary search on integer functions where the function is NOT strictly monotonic both ways.

Revision en1, by random_boi, 2018-10-23 10:32:29

So I know how to do ternary search on a function which is first strictly increasing and then strictly decreasing, but if the function is not strictly increasing but rather non decreasing and then non increasing, is it possible to modify our ternary search to obtain the maximum for such function?

Tags #binary search, ternary search, #math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English random_boi 2018-10-23 10:32:29 390 Initial revision (published)