Arrays "Binary Search"
Arrays "Binary Search"
“Binary search”
Thrayee ,Anagha
11:11PM
enda • Agenda • Agenda • Agenda • Agenda • Agenda • Agenda • Agenda • Agenda • Agenda • Agenda • Agenda • Agenda • Agen
Topics Covered
Introduction Algorithm
Agenda
Example
Members and
their roles
Thrayee - Introduction ,
Example
Anagha - Algorithm
INTRODUCTION
Binary search is a fundamental algorithm used to locate a specific element in
a sorted list or array. It operates by repeatedly dividing the search range in
half, which makes it highly efficient compared to linear search, especially for
large datasets. By comparing the target value with the middle element of
the current range, the algorithm eliminates half of the remaining possibilities
in each step. This structured approach ensures a logarithmic time
complexity, making binary search an indispensable tool for solving problems
that require fast and accurate data retrieval.
Back to Agenda Page
ection Header • Section Header • Section Header • Section Header • Section Header • Section Header • Section Header • Sectio
Header
Search • Binary Search • Binary Search • Binary Search • Binary Search • Section Header • Section Header • Section Header
ALGORITHM
Step 1: the elements in the array ar[] having n elements in sorted order.
Step 2: Input the elements to e searched, ns.
Step 3: Ib=0, ub=n-1, m=0, k=0.
Step 4: while(Ib<=ub) and k=0 repeat steps 5 to 7
Step 5: m=(Ib+ub)/2
Step 6: if(ns==ar[m]) then k=1
Step 7: if(ns<ar[m]) then ub=m-1, else Ib=m+1
Step 8: if k=1 then print “Search succesful” else print “Search unseccesful”.
Step 9: End
n Header • Section Header • Section Header • Section Header • Section Header • Section Header • Section Header • Section H
nary Search • Binary Search • Binary Search • Binary Search • Binary Search • Binary Search • Binary Searchr • Binary Sear
EXAMPLE
Imagine you are trying to find the phone number of "Sowmya" in a thick
phone book where names are listed alphabetically
n Header • Section Header • Section Header • Section Header • Section Header • Section Header • Section Header • Section H
Thank you!