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

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Meet Jain🦅

Meet Jain🦅 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @meetjain74

25 Sep
8 Websites to get APIs for your future projects for FREE🔥🔥

A thread🧵🧵
🔹RapidAPI - Contains almost any API you need

rapidapi.com/hub
🔹ProgrammableWeb - Collection of around 17000 APIs

programmableweb.com
Read 12 tweets
23 Sep
Understanding data structures and algorithms are crucial for every developer!!

How about understanding it with some real-world examples😉😉

Real-world examples of all data structures curated🧵
🔸A dating analogy to understand data structures
Read 11 tweets
22 Sep
Real-world examples of the Data structure "Graph"👇

A thread🧵
🔸Google maps navigation system
The navigation system is based on the algorithm to calculate the shortest path between two vertices.
🔸Social Graphs
Social graphs draw edges between you and the people, places, and things you interact with online.
Read 19 tweets
20 Sep
Real-world examples of the Data structure "Tree"👇

A thread🧵
🔸A tree
The nodes that give birth to other nodes under them is called a "parent node" and its children are simply called "daughter node" or "children nodes". The main stem of the tree is called the "root node".
🔸Family
The family of Mr. Alpha can be represented as a tree where Mr. Alpha has two children - Mr. Charlie and Mr. Romeo and similarly they both have two children.
Read 18 tweets
15 Sep
Writing your first Java program??

🔸How to compile and run it
🔸What does "Public Static Void Main" mean

A thread🧵
(1/11)
A simple Java program
(2/11)
How to save a Java program?

The program name must be saved as the class name in which the main function is declared.
Extension -> .java
Example here: First.java
Read 14 tweets
13 Sep
Some real-world examples of the Data structure "Stack"👇

A thread🧵
Stack is a LIFO (Last In First Out) data structure.
🔸A pile of books is an example of a stack. The last book kept on the pile will be removed first i.e LAST IN FIRST OUT (LIFO) data structure Image
Read 16 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(