SlideShare a Scribd company logo
2
Most read
SEARCHING TECHNIQUES
IN DATA STRUCTURE
Name-Subhrasis Biswal
Regd no.-220301120168
What is searching?
 Searching is a method to locate elements in
a list based on a given value or element.
 The success of a search depends on
whether the item is found or not.
 This operation helps determine the position
of an element within the list.
 The technique aims to identify the existence
and location of the specified value.
Searching Techniques
There are tow types of searching in data
structure
 Linear Search
 Binary Search
Linear Search
 Linear search is a simple algorithm,
sequentially checking items one by one.
 It searches for a match and returns the item
if found.
 If no match, the search continues until the
end of the data collection.
 This method is straightforward but may be
inefficient for large datasets.
Linear Search Algorithm
 Linear Search ( Array A, Value x)
 Step 1: Set i to 1
 Step 2: if i > n then go to step 7
 Step 3: if A[i] = x then go to step 6
 Step 4: Set i to i + 1
 Step 5: Go to Step 2
 Step 6: Print Element x Found at index i and go to
step 8
 Step 7: Print element not found
 Step 8: Exit
Binary search
Searching is a method to locate elements in a
list based on a given value or element.
The success of a search depends on whether
the item is found or not.
This operation helps determine the position of
an element within the list.
 The technique aims to identify the existence
and location of the specified value.
Binary Search Algorithm
 Compare x with the middle element.
 If x matches with middle element, we return
the mid index.
 Else If x is greater than the mid element, then
x can only lie in right half subarray after the
mid element. So we recur for right half.
 Else (x is smaller) recur for the left half.
Binary vs. Linear Search
•Input data needs to be sorted in Binary Search and not in Linear
Search
•Linear search does the sequential access whereas Binary search
access data randomly.
•Time complexity of linear search -O(n) , Binary search has time
complexity O(log n).
•Linear search performs equality comparisons and Binary search
performs ordering comparisons
Thank
you

More Related Content

PPTX
seaching internal 2 ppt.pptx
PPT
Searching in c language
PPTX
Searching techniques in Data Structure And Algorithm
PDF
searching
PPTX
Searching & Algorithms IN DATA STRUCTURES
PPTX
Data structure Unit - II Searching and Sorting.pptx
PPTX
Searching in Data Structure
PPTX
Searching Techniques and Analysis
seaching internal 2 ppt.pptx
Searching in c language
Searching techniques in Data Structure And Algorithm
searching
Searching & Algorithms IN DATA STRUCTURES
Data structure Unit - II Searching and Sorting.pptx
Searching in Data Structure
Searching Techniques and Analysis

Similar to seaching internal 2 ppt (20)

DOCX
MODULE 5-Searching and-sorting
PPTX
Searching_Techniques Linear search Algorithm
DOCX
PPS 5.5.BASIC ALGORITHMS SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.), BASI...
PDF
Ocw chp6 2searchbinary
PPTX
unit II_2_i.pptx
PPT
Chapter 11 ds
PPTX
DS - Unit 2 FINAL (2).pptx
PPTX
Data Structures_ Sorting & Searching
PDF
programming in C
PPTX
Searching Algorithm.pptx
PPTX
Data Structures Unit 2 FINAL presentation.pptx
PPTX
Dsa – data structure and algorithms searching
PPTX
Searching techniques
PPTX
Searching in DSA that follow a dsa searching.pptx
PPT
4- searching.ppt
PPTX
Presentation on Searching and Sorting in C language.pptx
PDF
IRJET- A Survey on Different Searching Algorithms
PPTX
Presentation
PPTX
data_structure_Chapter two_computer.pptx
PPTX
Searching and Sorting Unit II Part I.pptx
MODULE 5-Searching and-sorting
Searching_Techniques Linear search Algorithm
PPS 5.5.BASIC ALGORITHMS SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.), BASI...
Ocw chp6 2searchbinary
unit II_2_i.pptx
Chapter 11 ds
DS - Unit 2 FINAL (2).pptx
Data Structures_ Sorting & Searching
programming in C
Searching Algorithm.pptx
Data Structures Unit 2 FINAL presentation.pptx
Dsa – data structure and algorithms searching
Searching techniques
Searching in DSA that follow a dsa searching.pptx
4- searching.ppt
Presentation on Searching and Sorting in C language.pptx
IRJET- A Survey on Different Searching Algorithms
Presentation
data_structure_Chapter two_computer.pptx
Searching and Sorting Unit II Part I.pptx
Ad

Recently uploaded (20)

PPTX
climate analysis of Dhaka ,Banglades.pptx
PDF
.pdf is not working space design for the following data for the following dat...
PDF
Optimise Shopper Experiences with a Strong Data Estate.pdf
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PPTX
SAP 2 completion done . PRESENTATION.pptx
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPTX
Computer network topology notes for revision
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PDF
Introduction to the R Programming Language
PPTX
Supervised vs unsupervised machine learning algorithms
PDF
Introduction to Data Science and Data Analysis
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PDF
Transcultural that can help you someday.
PPTX
Database Infoormation System (DBIS).pptx
PDF
annual-report-2024-2025 original latest.
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
Managing Community Partner Relationships
PPTX
modul_python (1).pptx for professional and student
PPT
Miokarditis (Inflamasi pada Otot Jantung)
climate analysis of Dhaka ,Banglades.pptx
.pdf is not working space design for the following data for the following dat...
Optimise Shopper Experiences with a Strong Data Estate.pdf
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
SAP 2 completion done . PRESENTATION.pptx
Introduction-to-Cloud-ComputingFinal.pptx
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Computer network topology notes for revision
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
Introduction to the R Programming Language
Supervised vs unsupervised machine learning algorithms
Introduction to Data Science and Data Analysis
oil_refinery_comprehensive_20250804084928 (1).pptx
Transcultural that can help you someday.
Database Infoormation System (DBIS).pptx
annual-report-2024-2025 original latest.
IB Computer Science - Internal Assessment.pptx
Managing Community Partner Relationships
modul_python (1).pptx for professional and student
Miokarditis (Inflamasi pada Otot Jantung)
Ad

seaching internal 2 ppt

  • 1. SEARCHING TECHNIQUES IN DATA STRUCTURE Name-Subhrasis Biswal Regd no.-220301120168
  • 2. What is searching?  Searching is a method to locate elements in a list based on a given value or element.  The success of a search depends on whether the item is found or not.  This operation helps determine the position of an element within the list.  The technique aims to identify the existence and location of the specified value.
  • 3. Searching Techniques There are tow types of searching in data structure  Linear Search  Binary Search
  • 4. Linear Search  Linear search is a simple algorithm, sequentially checking items one by one.  It searches for a match and returns the item if found.  If no match, the search continues until the end of the data collection.  This method is straightforward but may be inefficient for large datasets.
  • 5. Linear Search Algorithm  Linear Search ( Array A, Value x)  Step 1: Set i to 1  Step 2: if i > n then go to step 7  Step 3: if A[i] = x then go to step 6  Step 4: Set i to i + 1  Step 5: Go to Step 2  Step 6: Print Element x Found at index i and go to step 8  Step 7: Print element not found  Step 8: Exit
  • 6. Binary search Searching is a method to locate elements in a list based on a given value or element. The success of a search depends on whether the item is found or not. This operation helps determine the position of an element within the list.  The technique aims to identify the existence and location of the specified value.
  • 7. Binary Search Algorithm  Compare x with the middle element.  If x matches with middle element, we return the mid index.  Else If x is greater than the mid element, then x can only lie in right half subarray after the mid element. So we recur for right half.  Else (x is smaller) recur for the left half.
  • 8. Binary vs. Linear Search •Input data needs to be sorted in Binary Search and not in Linear Search •Linear search does the sequential access whereas Binary search access data randomly. •Time complexity of linear search -O(n) , Binary search has time complexity O(log n). •Linear search performs equality comparisons and Binary search performs ordering comparisons