SlideShare a Scribd company logo
1 of 8
Linear Search in Data Structure
Prof. Neeraj Bhargava
Kapil Chauhan
Department of Computer Science
School of Engineering & Systems Sciences
MDS University, Ajmer
Introduction
๏‚— Linear search is a very simple search algorithm.
๏‚— In this type of search, a sequential search is made over
all items one by one.
๏‚— Every item is checked and if a match is found then that
particular item is returned, otherwise the search
continues till the end of the data collection.
Implementing Linear Search
๏‚— Following are the steps of implementation that we will
be following:
๏‚— Traverse the array using a for loop.
๏‚— In every iteration, compare the target value with the
current value of the array.
Cont..
๏‚— If the values match, return the current index of the
array.
๏‚— If the values do not match, move on to the next array
element.
๏‚— If no match is found, return -1.
Example
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
Cont..
๏‚— 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
Assignment
๏‚— Explain linear search in DS with suitable example and
also discuss algorithm.

More Related Content

What's hot

Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation AhmedAlbutty
ย 
Presentation on the topic selection sort
Presentation on the topic selection sortPresentation on the topic selection sort
Presentation on the topic selection sortDistrict Administration
ย 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structureVardhil Patel
ย 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeManishPrajapati78
ย 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structureeShikshak
ย 
Rahat & juhith
Rahat & juhithRahat & juhith
Rahat & juhithRj Juhith
ย 
Searching linear & binary search
Searching linear & binary searchSearching linear & binary search
Searching linear & binary searchnikunjandy
ย 
Binary Search
Binary SearchBinary Search
Binary Searchkunj desai
ย 
Insertion sort
Insertion sortInsertion sort
Insertion sortalmaqboli
ย 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data StructureMeghaj Mallick
ย 
Selection sort
Selection sortSelection sort
Selection sortsmlagustin
ย 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
ย 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...Umesh Kumar
ย 
Recursion - Algorithms and Data Structures
Recursion - Algorithms and Data StructuresRecursion - Algorithms and Data Structures
Recursion - Algorithms and Data StructuresPriyanka Rana
ย 
sorting and its types
sorting and its typessorting and its types
sorting and its typesSIVASHANKARIRAJAN
ย 
Sequential & binary, linear search
Sequential & binary, linear searchSequential & binary, linear search
Sequential & binary, linear searchmontazur420
ย 
Binary search python
Binary search pythonBinary search python
Binary search pythonMaryamAnwar10
ย 

What's hot (20)

Bubble sort
Bubble sortBubble sort
Bubble sort
ย 
Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation
ย 
Presentation on the topic selection sort
Presentation on the topic selection sortPresentation on the topic selection sort
Presentation on the topic selection sort
ย 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structure
ย 
Searching
SearchingSearching
Searching
ย 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
ย 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structure
ย 
Rahat & juhith
Rahat & juhithRahat & juhith
Rahat & juhith
ย 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
ย 
Searching linear & binary search
Searching linear & binary searchSearching linear & binary search
Searching linear & binary search
ย 
Binary Search
Binary SearchBinary Search
Binary Search
ย 
Insertion sort
Insertion sortInsertion sort
Insertion sort
ย 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
ย 
Selection sort
Selection sortSelection sort
Selection sort
ย 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
ย 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
ย 
Recursion - Algorithms and Data Structures
Recursion - Algorithms and Data StructuresRecursion - Algorithms and Data Structures
Recursion - Algorithms and Data Structures
ย 
sorting and its types
sorting and its typessorting and its types
sorting and its types
ย 
Sequential & binary, linear search
Sequential & binary, linear searchSequential & binary, linear search
Sequential & binary, linear search
ย 
Binary search python
Binary search pythonBinary search python
Binary search python
ย 

Similar to Linear search in ds

seaching internal 2 ppt
seaching internal 2 pptseaching internal 2 ppt
seaching internal 2 pptSubhrasisBiswal1
ย 
Linear and Binary search .pptx
Linear and Binary search .pptxLinear and Binary search .pptx
Linear and Binary search .pptxp83629918
ย 
Presentation
PresentationPresentation
Presentationzohaib arif
ย 
Dsa โ€“ data structure and algorithms searching
Dsa โ€“ data structure and algorithms   searchingDsa โ€“ data structure and algorithms   searching
Dsa โ€“ data structure and algorithms searchingsajinis3
ย 
MODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingMODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingnikshaikh786
ย 
Searching techniques
Searching techniquesSearching techniques
Searching techniquesArchana Burujwale
ย 
Presentation on Searching and Sorting in C language.pptx
Presentation on Searching and Sorting in C language.pptxPresentation on Searching and Sorting in C language.pptx
Presentation on Searching and Sorting in C language.pptxKrishnanandmishra15
ย 
programming in C
programming in Cprogramming in C
programming in CADITHYAM19
ย 
4.1 sequentioal search
4.1 sequentioal search4.1 sequentioal search
4.1 sequentioal searchKrish_ver2
ย 
DS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptxDS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptxprakashvs7
ย 
Data Structures_ Sorting & Searching
Data Structures_ Sorting & SearchingData Structures_ Sorting & Searching
Data Structures_ Sorting & SearchingThenmozhiK5
ย 
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptxAyanMandal44
ย 
Searching_Sorting.pptx
Searching_Sorting.pptxSearching_Sorting.pptx
Searching_Sorting.pptx21BD1A058RSahithi
ย 
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHIBCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHISowmya Jyothi
ย 
unit II_2_i.pptx
unit II_2_i.pptxunit II_2_i.pptx
unit II_2_i.pptxHODElex
ย 
Government Polytechnic Lucknow.pptx
Government Polytechnic Lucknow.pptxGovernment Polytechnic Lucknow.pptx
Government Polytechnic Lucknow.pptxUtkarshTiwari736372
ย 
Searching Sorting
Searching SortingSearching Sorting
Searching Sortingguest2cb109
ย 

Similar to Linear search in ds (20)

seaching internal 2 ppt
seaching internal 2 pptseaching internal 2 ppt
seaching internal 2 ppt
ย 
Linear and Binary search .pptx
Linear and Binary search .pptxLinear and Binary search .pptx
Linear and Binary search .pptx
ย 
Searching
Searching Searching
Searching
ย 
Presentation
PresentationPresentation
Presentation
ย 
Dsa โ€“ data structure and algorithms searching
Dsa โ€“ data structure and algorithms   searchingDsa โ€“ data structure and algorithms   searching
Dsa โ€“ data structure and algorithms searching
ย 
MODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingMODULE 5-Searching and-sorting
MODULE 5-Searching and-sorting
ย 
Searching techniques
Searching techniquesSearching techniques
Searching techniques
ย 
Presentation on Searching and Sorting in C language.pptx
Presentation on Searching and Sorting in C language.pptxPresentation on Searching and Sorting in C language.pptx
Presentation on Searching and Sorting in C language.pptx
ย 
programming in C
programming in Cprogramming in C
programming in C
ย 
4.1 sequentioal search
4.1 sequentioal search4.1 sequentioal search
4.1 sequentioal search
ย 
DS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptxDS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptx
ย 
Data Structures_ Sorting & Searching
Data Structures_ Sorting & SearchingData Structures_ Sorting & Searching
Data Structures_ Sorting & Searching
ย 
Lecture_Oct26.pptx
Lecture_Oct26.pptxLecture_Oct26.pptx
Lecture_Oct26.pptx
ย 
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
ย 
Searching_Sorting.pptx
Searching_Sorting.pptxSearching_Sorting.pptx
Searching_Sorting.pptx
ย 
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHIBCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES SEARCHING AND SORTING MRS.SOWMYA JYOTHI
ย 
unit II_2_i.pptx
unit II_2_i.pptxunit II_2_i.pptx
unit II_2_i.pptx
ย 
Government Polytechnic Lucknow.pptx
Government Polytechnic Lucknow.pptxGovernment Polytechnic Lucknow.pptx
Government Polytechnic Lucknow.pptx
ย 
Searching Sorting
Searching SortingSearching Sorting
Searching Sorting
ย 
Unit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTINGUnit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTING
ย 

More from chauhankapil

Gray level transformation
Gray level transformationGray level transformation
Gray level transformationchauhankapil
ย 
Elements of visual perception
Elements of visual perceptionElements of visual perception
Elements of visual perceptionchauhankapil
ย 
JSP Client Request
JSP Client RequestJSP Client Request
JSP Client Requestchauhankapil
ย 
Jsp server response
Jsp   server responseJsp   server response
Jsp server responsechauhankapil
ย 
Markov decision process
Markov decision processMarkov decision process
Markov decision processchauhankapil
ย 
RNN basics in deep learning
RNN basics in deep learningRNN basics in deep learning
RNN basics in deep learningchauhankapil
ย 
Introduction to generative adversarial networks (GANs)
Introduction to generative adversarial networks (GANs)Introduction to generative adversarial networks (GANs)
Introduction to generative adversarial networks (GANs)chauhankapil
ย 
Bayesian probabilistic interference
Bayesian probabilistic interferenceBayesian probabilistic interference
Bayesian probabilistic interferencechauhankapil
ย 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in javachauhankapil
ย 
Knowledge acquistion
Knowledge acquistionKnowledge acquistion
Knowledge acquistionchauhankapil
ย 
Knowledge based system
Knowledge based systemKnowledge based system
Knowledge based systemchauhankapil
ย 
Introduction of predicate logics
Introduction of predicate  logicsIntroduction of predicate  logics
Introduction of predicate logicschauhankapil
ย 
Types of inheritance in java
Types of inheritance in javaTypes of inheritance in java
Types of inheritance in javachauhankapil
ย 
Representation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logicsRepresentation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logicschauhankapil
ย 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javachauhankapil
ย 
Propositional logic
Propositional logicPropositional logic
Propositional logicchauhankapil
ย 
Constructors in java
Constructors in javaConstructors in java
Constructors in javachauhankapil
ย 
Methods in java
Methods in javaMethods in java
Methods in javachauhankapil
ย 
Circular linked list
Circular linked listCircular linked list
Circular linked listchauhankapil
ย 

More from chauhankapil (20)

Gray level transformation
Gray level transformationGray level transformation
Gray level transformation
ย 
Elements of visual perception
Elements of visual perceptionElements of visual perception
Elements of visual perception
ย 
JSP Client Request
JSP Client RequestJSP Client Request
JSP Client Request
ย 
Jsp server response
Jsp   server responseJsp   server response
Jsp server response
ย 
Markov decision process
Markov decision processMarkov decision process
Markov decision process
ย 
RNN basics in deep learning
RNN basics in deep learningRNN basics in deep learning
RNN basics in deep learning
ย 
Introduction to generative adversarial networks (GANs)
Introduction to generative adversarial networks (GANs)Introduction to generative adversarial networks (GANs)
Introduction to generative adversarial networks (GANs)
ย 
Bayesian probabilistic interference
Bayesian probabilistic interferenceBayesian probabilistic interference
Bayesian probabilistic interference
ย 
Jsp
JspJsp
Jsp
ย 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
ย 
Knowledge acquistion
Knowledge acquistionKnowledge acquistion
Knowledge acquistion
ย 
Knowledge based system
Knowledge based systemKnowledge based system
Knowledge based system
ย 
Introduction of predicate logics
Introduction of predicate  logicsIntroduction of predicate  logics
Introduction of predicate logics
ย 
Types of inheritance in java
Types of inheritance in javaTypes of inheritance in java
Types of inheritance in java
ย 
Representation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logicsRepresentation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logics
ย 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
ย 
Propositional logic
Propositional logicPropositional logic
Propositional logic
ย 
Constructors in java
Constructors in javaConstructors in java
Constructors in java
ย 
Methods in java
Methods in javaMethods in java
Methods in java
ย 
Circular linked list
Circular linked listCircular linked list
Circular linked list
ย 

Recently uploaded

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
ย 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
ย 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
ย 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
ย 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
ย 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
ย 
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
ย 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
ย 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
ย 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
ย 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
ย 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
ย 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
ย 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
ย 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
ย 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
ย 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
ย 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
ย 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
ย 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
ย 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
ย 
young call girls in Green Park๐Ÿ” 9953056974 ๐Ÿ” escort Service
young call girls in Green Park๐Ÿ” 9953056974 ๐Ÿ” escort Serviceyoung call girls in Green Park๐Ÿ” 9953056974 ๐Ÿ” escort Service
young call girls in Green Park๐Ÿ” 9953056974 ๐Ÿ” escort Service
ย 
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
ย 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
ย 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
ย 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
ย 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
ย 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
ย 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
ย 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
ย 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
ย 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
ย 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
ย 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
ย 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
ย 

Linear search in ds

  • 1. Linear Search in Data Structure Prof. Neeraj Bhargava Kapil Chauhan Department of Computer Science School of Engineering & Systems Sciences MDS University, Ajmer
  • 2. Introduction ๏‚— Linear search is a very simple search algorithm. ๏‚— In this type of search, a sequential search is made over all items one by one. ๏‚— Every item is checked and if a match is found then that particular item is returned, otherwise the search continues till the end of the data collection.
  • 3. Implementing Linear Search ๏‚— Following are the steps of implementation that we will be following: ๏‚— Traverse the array using a for loop. ๏‚— In every iteration, compare the target value with the current value of the array.
  • 4. Cont.. ๏‚— If the values match, return the current index of the array. ๏‚— If the values do not match, move on to the next array element. ๏‚— If no match is found, return -1.
  • 6. 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
  • 7. Cont.. ๏‚— 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
  • 8. Assignment ๏‚— Explain linear search in DS with suitable example and also discuss algorithm.