SlideShare a Scribd company logo
Linear Search for design and analysis of algorithm
What Is Searching?
• Searching is the process of fetching a specific element in a collection
of elements.
• The collection can be an array or a linked list. If you find the element
in the list, the process is considered successful, and it returns the
location of that element.
• And in contrast, if you do not find the element, it deems the search
unsuccessful.
What Is a Linear Search Algorithm?
• Linear search, often known as sequential search, is the most basic
search technique.
• In this type of search, you go through the entire list and try to fetch a
match for a single element. If you find a match, then the address of
the matching target element is returned.
• On the other hand, if the element is not found, then it returns a NULL
value.
Example
• Following is a step-by-step approach employed to perform Linear
Search Algorithm.
• The procedures for implementing linear search are as follows:
• Step 1: First, read the search element (Target element) in the array.
• Step 2: In the second step compare the search element with the first
element in the array.
• Step 3: If both are matched, display "Target element is found" and
terminate the Linear Search function.
• Step 4: If both are not matched, compare the search element with the next
element in the array.
• Step 5: In this step, repeat steps 3 and 4 until the search (Target) element is
compared with the last element of the array.
• Step 6 - If the last element in the list does not match, the Linear Search
Function will be terminated, and the message "Element is not found" will be
displayed.
• So far, you have explored the fundamental definition and the working
terminology of the Linear Search Algorithm.
Linear Search for design and analysis of algorithm
Linear Search for design and analysis of algorithm
Linear Search for design and analysis of algorithm
Linear Search for design and analysis of algorithm
Linear Search for design and analysis of algorithm
Linear Search Terminates
• A perfect match is found, you stop comparing any further elements
and terminate the Linear Search Algorithm and display the element
found at location 4.
Ad

More Related Content

Similar to Linear Search for design and analysis of algorithm (20)

Searching_Techniques Binary search Algorithm
Searching_Techniques Binary search AlgorithmSearching_Techniques Binary search Algorithm
Searching_Techniques Binary search Algorithm
Anil Yadav
 
seaching internal 2 ppt
seaching internal 2 pptseaching internal 2 ppt
seaching internal 2 ppt
SubhrasisBiswal1
 
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
Krishnanandmishra15
 
Data Structures_ Sorting & Searching
Data Structures_ Sorting & SearchingData Structures_ Sorting & Searching
Data Structures_ Sorting & Searching
ThenmozhiK5
 
DS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptxDS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptx
prakashvs7
 
Binary search
Binary search Binary search
Binary search
Ramkrishna bhagat
 
Searching in c language
Searching in c languageSearching in c language
Searching in c language
CHANDAN KUMAR
 
4- searching.ppt
4- searching.ppt4- searching.ppt
4- searching.ppt
zabihniazai1
 
Searching techniques
Searching techniquesSearching techniques
Searching techniques
Archana Burujwale
 
Binary search
Binary searchBinary search
Binary search
Gaurav Solanki
 
Data structure and algorithms
Data structure and algorithmsData structure and algorithms
Data structure and algorithms
technologygyan
 
data_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptxdata_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptx
Mohammed472103
 
searching
searchingsearching
searching
A. S. M. Shafi
 
Introduction to Searching Algorithm for beginners
Introduction to Searching Algorithm for beginnersIntroduction to Searching Algorithm for beginners
Introduction to Searching Algorithm for beginners
JoshuaEddyson1
 
4.1 sequentioal search
4.1 sequentioal search4.1 sequentioal search
4.1 sequentioal search
Krish_ver2
 
Searching Algorithms for students of CS and IT using C++
Searching Algorithms for students of CS and IT using C++Searching Algorithms for students of CS and IT using C++
Searching Algorithms for students of CS and IT using C++
shahidameer8
 
SORTING techniques.pptx
SORTING techniques.pptxSORTING techniques.pptx
SORTING techniques.pptx
Dr.Shweta
 
Searching,sorting
Searching,sortingSearching,sorting
Searching,sorting
LavanyaJ28
 
Insertion sort & Linear Search presentation
Insertion sort & Linear Search presentationInsertion sort & Linear Search presentation
Insertion sort & Linear Search presentation
SaranshGupta923104
 
Data operatons & searching and sorting algorithms
Data operatons & searching and sorting algorithmsData operatons & searching and sorting algorithms
Data operatons & searching and sorting algorithms
Anushdika Jeganathan
 
Searching_Techniques Binary search Algorithm
Searching_Techniques Binary search AlgorithmSearching_Techniques Binary search Algorithm
Searching_Techniques Binary search Algorithm
Anil Yadav
 
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
Krishnanandmishra15
 
Data Structures_ Sorting & Searching
Data Structures_ Sorting & SearchingData Structures_ Sorting & Searching
Data Structures_ Sorting & Searching
ThenmozhiK5
 
DS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptxDS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptx
prakashvs7
 
Searching in c language
Searching in c languageSearching in c language
Searching in c language
CHANDAN KUMAR
 
Data structure and algorithms
Data structure and algorithmsData structure and algorithms
Data structure and algorithms
technologygyan
 
data_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptxdata_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptx
Mohammed472103
 
Introduction to Searching Algorithm for beginners
Introduction to Searching Algorithm for beginnersIntroduction to Searching Algorithm for beginners
Introduction to Searching Algorithm for beginners
JoshuaEddyson1
 
4.1 sequentioal search
4.1 sequentioal search4.1 sequentioal search
4.1 sequentioal search
Krish_ver2
 
Searching Algorithms for students of CS and IT using C++
Searching Algorithms for students of CS and IT using C++Searching Algorithms for students of CS and IT using C++
Searching Algorithms for students of CS and IT using C++
shahidameer8
 
SORTING techniques.pptx
SORTING techniques.pptxSORTING techniques.pptx
SORTING techniques.pptx
Dr.Shweta
 
Searching,sorting
Searching,sortingSearching,sorting
Searching,sorting
LavanyaJ28
 
Insertion sort & Linear Search presentation
Insertion sort & Linear Search presentationInsertion sort & Linear Search presentation
Insertion sort & Linear Search presentation
SaranshGupta923104
 
Data operatons & searching and sorting algorithms
Data operatons & searching and sorting algorithmsData operatons & searching and sorting algorithms
Data operatons & searching and sorting algorithms
Anushdika Jeganathan
 

More from JavedKhan524377 (8)

Deep learning intro and examples and types
Deep learning intro and examples and typesDeep learning intro and examples and types
Deep learning intro and examples and types
JavedKhan524377
 
Greedy algorithm for design and analysis
Greedy algorithm for design and analysisGreedy algorithm for design and analysis
Greedy algorithm for design and analysis
JavedKhan524377
 
Binary Search Tree for design and analysis
Binary Search Tree for design and analysisBinary Search Tree for design and analysis
Binary Search Tree for design and analysis
JavedKhan524377
 
Software Engineering Book for beginnerss
Software Engineering Book for beginnerssSoftware Engineering Book for beginnerss
Software Engineering Book for beginnerss
JavedKhan524377
 
Software tetsing paper related to industry
Software tetsing paper related to industrySoftware tetsing paper related to industry
Software tetsing paper related to industry
JavedKhan524377
 
Week 1 Lecture 1 LAB Weka lecture for machine learning
Week 1 Lecture 1 LAB Weka lecture for machine learningWeek 1 Lecture 1 LAB Weka lecture for machine learning
Week 1 Lecture 1 LAB Weka lecture for machine learning
JavedKhan524377
 
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
JavedKhan524377
 
chapter_3_8 of software requirements engineering
chapter_3_8 of software requirements engineeringchapter_3_8 of software requirements engineering
chapter_3_8 of software requirements engineering
JavedKhan524377
 
Deep learning intro and examples and types
Deep learning intro and examples and typesDeep learning intro and examples and types
Deep learning intro and examples and types
JavedKhan524377
 
Greedy algorithm for design and analysis
Greedy algorithm for design and analysisGreedy algorithm for design and analysis
Greedy algorithm for design and analysis
JavedKhan524377
 
Binary Search Tree for design and analysis
Binary Search Tree for design and analysisBinary Search Tree for design and analysis
Binary Search Tree for design and analysis
JavedKhan524377
 
Software Engineering Book for beginnerss
Software Engineering Book for beginnerssSoftware Engineering Book for beginnerss
Software Engineering Book for beginnerss
JavedKhan524377
 
Software tetsing paper related to industry
Software tetsing paper related to industrySoftware tetsing paper related to industry
Software tetsing paper related to industry
JavedKhan524377
 
Week 1 Lecture 1 LAB Weka lecture for machine learning
Week 1 Lecture 1 LAB Weka lecture for machine learningWeek 1 Lecture 1 LAB Weka lecture for machine learning
Week 1 Lecture 1 LAB Weka lecture for machine learning
JavedKhan524377
 
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
JavedKhan524377
 
chapter_3_8 of software requirements engineering
chapter_3_8 of software requirements engineeringchapter_3_8 of software requirements engineering
chapter_3_8 of software requirements engineering
JavedKhan524377
 
Ad

Recently uploaded (20)

What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Ad

Linear Search for design and analysis of algorithm

  • 2. What Is Searching? • Searching is the process of fetching a specific element in a collection of elements. • The collection can be an array or a linked list. If you find the element in the list, the process is considered successful, and it returns the location of that element. • And in contrast, if you do not find the element, it deems the search unsuccessful.
  • 3. What Is a Linear Search Algorithm? • Linear search, often known as sequential search, is the most basic search technique. • In this type of search, you go through the entire list and try to fetch a match for a single element. If you find a match, then the address of the matching target element is returned. • On the other hand, if the element is not found, then it returns a NULL value.
  • 4. Example • Following is a step-by-step approach employed to perform Linear Search Algorithm.
  • 5. • The procedures for implementing linear search are as follows: • Step 1: First, read the search element (Target element) in the array. • Step 2: In the second step compare the search element with the first element in the array. • Step 3: If both are matched, display "Target element is found" and terminate the Linear Search function.
  • 6. • Step 4: If both are not matched, compare the search element with the next element in the array. • Step 5: In this step, repeat steps 3 and 4 until the search (Target) element is compared with the last element of the array. • Step 6 - If the last element in the list does not match, the Linear Search Function will be terminated, and the message "Element is not found" will be displayed. • So far, you have explored the fundamental definition and the working terminology of the Linear Search Algorithm.
  • 12. Linear Search Terminates • A perfect match is found, you stop comparing any further elements and terminate the Linear Search Algorithm and display the element found at location 4.
  翻译: