This post will introduce one specific application of Binary Search, i.e., when you are asked to find the upper or lower bound, or more precisely, when you need to find the maximum of the smallest value or the minimum of the largest value.

This is originally posted at https://shawnlyu.com/algorithms/binary-search-find-upper-and-lower-bound/

This post will introduce one specific application of Binary Search, i.e., when you are asked to find the upper or lower bound, or more precisely, when you need to find **the maximum of the smallest value or the minimum of the largest value**.

Binary Search is an algorithm to search for a target from a sorted array. It selects the middle element in the array and compares it against the target; if they are not equal, it eliminates one half of the array and keeps searching the other half in the same manner(Wikipedia).

The most basic application of it is to find a number or a position from an array. Some practices could be found on Leetcode:

- 278. First Bad Version
- 33. Search in Rotated Sorted Array
- 34. Find First and Last Position of Element in Sorted Array
- 4. Median of Two Sorted Arrays

Another popular case to apply is when you are asked to find **the maximum of the smallest value or the minimum of the largest value**. Let’ take 410. Split Array Largest Sum from Leetcode as an example to illustrate how to deal with this kind of problem.

data-structures computer-science binary-search leetcode data-science

In Conversation With Dr Suman Sanyal, NIIT University,he shares his insights on how universities can contribute to this highly promising sector and what aspirants can do to build a successful data science career.

For this week’s latest data science job openings, we have come up with a curated list of job openings for data scientists and analysts.

Online Data Science Training in Noida at CETPA, best institute in India for Data Science Online Course and Certification. Call now at 9911417779 to avail 50% discount.

Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments. Our latest survey report suggests that as the overall Data Science and Analytics market evolves to adapt to the constantly changing economic and business environments, data scientists and AI practitioners should be aware of the skills and tools that the broader community is working on. A good grip in these skills will further help data science enthusiasts to get the best jobs that various industries in their data science functions are offering.

The biggest problem we face today is the commoditization of education. Individuals and corporations alike would like quality courses to be offered by the best faculty at the lowest price