Back to Browse

3 Binary Search on Reverse Sorted Array

147.8K views
Mar 11, 2020
4:41

BINARY SEARCH ON REVERSE SORTED ARRAY: Let's suppose that we have an array sorted in descending order and we want to find index of an element e within this array. Binary search in every step picks the middle element (m) of the array and compares it to e. If these elements are equal, than it returns the index of m. If e is greater than m, than e must be located in the left subarray. On the contrary, if m greater than e, e must be located in the right subarray. At this moment binary search repeats the step on the respective subrarray. Because the algoritm splits in every step the array in half (and one half of the array is never processed) the input element must be located (or determined missing) in at most \\log_{2}{n} steps. PROBLEM STATEMENT LINK:http://www.programming-algorithms.net/article/40119/Binary-search PLAYLIST LINK:https://www.youtube.com/playlist?list=PL_z_8CaSLPWeYfhtuKHj-9MpYb6XQJ_f2 . ------------------------------------------------------------------------------------------ Here are some of the gears that I use almost everyday: 🖊️ : My Pen (Used in videos too): https://amzn.to/38fKSM1 👨🏻‍💻 : My Apple Macbook pro: https://amzn.to/3w8iZh6 💻 : My gaming laptop: https://amzn.to/3yjcn23 📱 : My Ipad: https://amzn.to/39yEMGS ✏️ : My Apple Pencil: https://amzn.to/3kMnKYf 🎧 : My Headphones: https://amzn.to/3kMOzM7 💺 : My Chair: https://amzn.to/385weqR 🛋 : My Table: https://amzn.to/3kMohtd ⏰ : My Clock: https://amzn.to/3slFUV3 🙋🏻‍♀️ : My girlfriend: https://amzn.to/3M6zLDK ¯\_(ツ)_/¯ PS: While having good gears help you perform efficiently, don’t get under the impression that they will make you successful without any hard work.

Download

1 formats

Video Formats

360pmp412.6 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

3 Binary Search on Reverse Sorted Array | NatokHD