0% found this document useful (0 votes)
3 views16 pages

Searching & Analysis

The document explains the concept of searching in computer science, detailing various searching techniques including linear, binary, and interpolation search. It focuses on linear search, describing its algorithm, advantages, disadvantages, and real-life applications such as in banking and library management systems. The document emphasizes the importance of understanding these techniques for efficient data retrieval.

Uploaded by

rohangolkar3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views16 pages

Searching & Analysis

The document explains the concept of searching in computer science, detailing various searching techniques including linear, binary, and interpolation search. It focuses on linear search, describing its algorithm, advantages, disadvantages, and real-life applications such as in banking and library management systems. The document emphasizes the importance of understanding these techniques for efficient data retrieval.

Uploaded by

rohangolkar3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Every One should know about how

to program a computer, because it


teaches you how to think

SEARCHING,
TECHNIQUES
&
ANALYSIS

NAME – ROHAN
CONTENT
 WHAT IS SEARCHING?
 EXPLANATION WITH EXAMPLE

 SEARCHING TECHNIQUES!
 LINEAR SEARCH
 BINARY SEARCH
 INTERPOLATION SEARCH

 LINEAR SEARCH
 ALGORITHM & SYNTAX
 HOW LINEAR SEARCH WORKS ?

ADVANTAGES / DISADVANTAGES

APPLICATIONS OF LINEAR SEARCH


What is Searching ?
• Searching is an Operation or Technique –

• That helps to find the place of a given element or


value in the list.

• If the element is found than it called successful search

• And if the element is found than it is called as


unsuccessful search
REAL LIFE EXAMPLE

 Consider a database of Banking system


where information of customer is stored,
such as name, address and account number
etc. if a manager wants to search for a record
of a particular customer, he has to look for
that record from among all records that has
been stored in the database.

 This process of looking up for a particular


record in a database is referred as searching
Searching Techniques
There are 3 types of Searching in DSA-

Searching

Linear Search

Binary Search

Interpolation
Search
Linear Search (sequential search)

Linear Search is a very simple search algorithm-

• Which is made over all item one by one


• Every item is checked & if a match found, than the particular
item/ element is returned
• Otherwise the search continues till the end of the data
collection
Linear Search
Algorithm-
1 •Set i to 1

2 •If i>n then go to step 7

3 •If A[i]=x then go to step 6

4 •Set i to i+1

5 •Go to step 2

6 •Print Elements x found at index i and go to step 8

7 •Print Element not found

8 •Exit
How Linear Search works ?
Now see the working of the linear search algorithm.
Let’s take an sorted array. It will be easy to understand the working of
linear search with an example.
• Let the Element of Array are-
0 1 2 3 4 5 6

3 8 15 22 28 31 49

• Let the element to be searched is K = 28

0 1 2 3 4 5 6

3 8 15 22 28 31 49
 Now, starts from the first element and compare K with each element of the array.

0 1 2 3 4 5 6

3 8 15 22 28 31 49

K=3

 The value of K, i.e. 8 is not matched with the first element of the array. So, move to the next
element. And follow the same process untill the respective element is found.
0 1 2 3 4 5 6

3 8 15 22 28 31 49

K=8
0 1 2 3 4 5 6

3 8 15 22 28 31 49

K=15

0 1 2 3 4 5 6

3 8 15 22 28 31 49

K=22

0 1 2 3 4 5 6

3 8 15 22 28 31 49

K=28

Now the element to be searched is found. So algorithm will return the index of the
element matched.
WORKING OF BINARY & SEQUENTIAL SEARCH
ADVANTAGES OF LINEAR SRACH

Simplicity- Sequential search is a simple and easy-


to-understand algorithm

Easy implementation- This algorithm is easy to


implement and requires minimal code

Low Memory requirement- Sequential search


requires minimum memory to execute

Easy Debugging-This algorithm is easy to debug


and troubleshoot
DISADVANTAGES OF LINEAR SRACH

Slow Speed- Sequential search is a slow


algorithm, especially for large database

O(n) Time Complexity- The time complexity of


sequential is O(n), which means it becomes slower
as the dataset grow

Inefficient- Sequential search is an inefficient


algorithm, basically for large files

Not Scalable-This algorithm is not scalable and


cannot handle large datasets
APPLICATION OF SEARCHING
• Library Management:-
• DATABASE QUERYING:- Library Management
It is used in Database system me use hota hai
system for finding the
Data • Student Information
System:- For finding the
details of students it is
use in student
information system
APPLICATION OF SEARCHING
• CONTANT SEARCH:-
• SEARCH ENGINES:- Used in mobile phones
Search engines like for searching the
Google, Bing, & Yahoo contacts
use the linear search
• E-COMMERCE WEB:-
Platforms like Amazon,
Flipkart use searching
for products
U !
U U
YO

&
N K
A KEEP
T H
LEARNING

You might also like