medium10 pts · first answer countssorting-and-searching
Finding a peak with binary search
To find any peak (an item larger than both neighbours) in an unsorted array, a binary search compares a[mid] with a[mid + 1]. If a[mid] < a[mid + 1], what does it do?
Discussion 0
Join free to post in the discussion.
Related questions
- Bubble sort best case with early exitBackend Developer
- What a stable sort meansBackend Developer
- Merge sort time in every caseBackend Developer
- Best simple sort for nearly sorted dataBackend Developer
- Swaps made by selection sortBackend Developer
- What in-place sorting meansBackend Developer
- Quick sort worst-case timeBackend Developer
- JavaScript default sort on numbersBackend Developer