BS-2. Implement Lower Bound and Upper Bound | Search Insert Position | Floor and Ceil

Description

Lower Bound: https://bit.ly/43967G5

Upper Bound: https://bit.ly/3IoKGce

Search Insert Position: https://bit.ly/3ocI0HW

Floor and Ceil: https://www.codingninjas.com/codestudio/problems/ceiling-in-a-sorted-array_1825401

Notes/C++/Java/Python codes:

Implement Lower Bound: https://takeuforward.org/arrays/implement-lower-bound-bs-2/

Implement Upper Bound: https://takeuforward.org/arrays/implement-upper-bound/

Search Insert Position: https://takeuforward.org/arrays/search-insert-position/

Floor/Ceil in Sorted Array: https://takeuforward.org/arrays/floor-and-ceil-in-sorted-array/

We have solved the problem, and we have gone from brute force and ended with the most optimal solution. Every approach's code has been written in the video itself. Also, we have covered the algorithm with intuition.

Full Course: https://bit.ly/tufA2ZYt

You can follow me across social media, all my handles are below:

Linkedin/Instagram/Telegram: https://linktr.ee/takeUforward

0:00 Lower Bound Explanation using examples

10:53 Lower Bound Implementation

13:35 Lower Bound Code (in C++)

13:55 lower_bound() C++ STL method

15:33 Time Complexity Analysis of Lower Bound

15:46 Upper Bound Explanation using examples

17:23 Upper Bound Implementation

18:56 Upper Bound Code (in C++)

19:13 Time Complexity of Upper Bound

19:20 upper_bound() C++ STL method

19:47 Search Insert Position

22:53 Floor and Ceil in Sorted Array

28:44 How is Binary Search making sure that we get the smallest index?

31:40 Outro

Designed under CodEX ©2025 Nexus

Designed under CodEX ©2025 Nexus

Designed under CodEX ©2025 Nexus