Meet Jain🦅(🛠️,⛓️) Profile picture
21 | Blockchain🔗 | Web3 | DSA |💻 Follow to learn 🚀 Cofounder @0xSaturnHQ_ | Github: https://t.co/e3AtfUSxEk My followers are called Celestials!

Sep 24, 2021, 9 tweets

Variants of Binary Search
(Using recursive approach)

A thread 🧵

Binary search can be upgraded to the following five variants -
🔸Index of a particular key
🔸Index of the first occurrence of a key
🔸Index of the last occurrence of a key
🔸Index of least element greater than key
🔸Index of greatest element less than key

🔸Index of a particular key / Basic Binary search

🔸Index of the first occurrence of a key

🔸Index of the last occurrence of a key

🔸Index of least element greater than key

🔸Index of greatest element less than key

These are the recursive versions of code for these five variants.

If you liked this, make sure to:

1. Follow me @meetjain74

2. Retweet the first tweet

Thanks so much for getting to the end of the thread! Let me know your thoughts below

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling