#### CBSE Class 12 : Data Structures

Introduction to Data Structures

#### CBSE Class 12 : Searching

Creation And Traversal
What is Searching?
Linear/Sequential Search
Binary Search
Insertion Of Element
Deletion Of Element

What is sorting?
Bubble Sort
Selection Sort
Insertion Sort

# Class 12: Data Structures Searching 4

Binary Search
(Divide and Conquer Search)

[Sequential search is a simple and easy method. It is efficient for a small list of elements but highly inefficient for larger lists. In the worst case we have to make “N” comparisons to search the element]

In binary search a particular item/element with a certain key-value say “num” is to be searched. The approximately middle entry of the array is located then it is compared with “num”. if the value matches then the search becomes successful otherwise if the middle element is greater than “num” it means the element “num” may be present in first-half otherwise it may be present in the second half.

After deciding the half, we will repeat the process till either the element is found or the interval becomes empty.
This method is called binary search because at each step we reduce the length of the array to search by half.(2 parts).

We can imagine the efficiency of the binary search by the fact that in just about 20 steps this method can locate an element in a total of 1 million elements.

Note: elements should be sorted (Ascending order)

Important Pages