A list is strictly convex if its elements first decrease then increase. How can I write a function in python that accepts a convex list and returns its minima in time complexity O(log(n)), n being the size of the list. (NO USE OF ANY BUILT IN FUNCTIONS OVER LISTS)
Take the 2-minute tour
×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.
closed as unclear what you're asking by MichaelT, Wayne M, Giorgio, GlenH7, Bart van Ingen Schenau Jun 15 at 10:09Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question. |
|||||||||||||||||
|
Don't speak Python, but the idea seems fairly simple:
Remarks:
|
|||||
|
Since either the first or last element would have to be the lowest, how about this? I even provide a key argument
EDIT: well now you've changed your question. Since the built-in
|
|||||||||||||||||||||
|