When a given sequence is in a sorted order (be it ascending or descending), using binary search should be one of the first things that come to your mind.
- Sorting search results on a page given a certain set of criteria.
- Sort a list of numbers in which each number is at a distance `K` from its actual position.
- Given an array of integers, sort the array so that all odd indexes are greater than the even indexes.
- Given users with locations in a list and a logged-in user with locations, find their travel buddies (people who shared more than half of your locations).
- Search for an element in a sorted and rotated array.