Binary Search Algorithm Visualization and Implementation
1. 09 September 2022
BINARY SEARCH
P R E S E N T E D B Y :
D E B A B R A T A H A L D E R - 2 1 E E L C S 0 1 2
N I D H I Y A D A V - 2 1 E E L C S 0 2 6
S U B M I T T E D T O :
M r . D H A W A L V Y A S
M r . S U M I T K U M A R
G O V E R N M E N T E N G I N E E R I N G C O L L E G E B H A R A T P U R
2. INTRODUCTION
Computer Systems are used to store a lot of information from
which individual records must be recovered.
Therefore, searching is an algorithmic methodology of
discovering a specific thing in an accumulation of things.
3. WHAT IS BINARY
SEARCH?
A binary search algorithm searches the location or say position
of a specified input value within an array sorted by key value.
It is one of the algorithms that are used to find the item along
with its location in a sorted array by just dividing the array into
halves.
Binary Search is an O(log n) calculation, which is more proficient
than a linear search.
4. BINARY SEARCH ALGORITHM
If the value of the search key is equal to the item then
return an index of the search key.
2
Begin with the mid element of the whole array as a
search key.
1
Or if the value of the search key is less than the item in the
middle of the interval, narrow the interval to the lower
half.
3
Otherwise, narrow it to the upper half.
4
Repeatedly check from the second point until the value is
found or the interval is empty.
5
6. Algorithm visualization illustrates how algorithms work in
a graphical way. It mainly aims to simplify and deepen the
understanding of algorithms operation.
WHY ALGORITHM
VISUALIZATIONS?
Explain concepts in visual terms
Encourage a practical learning process
Experiment and explore the ideas with respect
to their individual needs.
7. Better than a Linear Search Algorithm.
Since its run time complexity is O(log N).
At each iteration, it eliminates half of the list and
significantly reduces the search space.
ADVANTAGES
It works even when the array is rotated by some
position and finds the target element.