ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Searching methods
• is an operation or a technique that helps finds the place of a
given element or value in the list.
• are designed to check for an element or retrieve an element
from any data structure where it is stored.
• is said to be successful or unsuccessful depending upon
whether the element that is being searched is found or not.
• standard techniques
• Sequential Search
• Interval Search
Linear Search
• simplest method for searching
• defined as a sequential search algorithm
• starts at one end and goes through each element of a list until
the desired element is found
• otherwise the search continues till the end of the data set
Linear Search
• Given an array arr[] of N elements, the task is to write a
function to search a given element x in arr[].
• Iterate from 0 to N-1 and compare the value of every index with
x if they match return index.
Steps for Linear Search
• Start from the leftmost element of arr[] and one by one compare
x with each element of arr[]
• If x matches with an element, return the index.
• If x doesn’t match with any of the elements, return -1.
Algorithm for Linear Search
• algorithm Seqnl_Search(list, item)
• Pre: list != ;
• Post: return the index of the item if found, otherwise: 1
• index <- fi
• while index < list.Cnt and list[index] != item //cnt: counter variable
• index <- index + 1
• end while
• if index < list.Cnt and list[index] = item
• return index
• end if
• return: 1
Linear Search implementation in C
Binary search
• is a very fast and efficient searching technique.
• requires the list to be in sorted order.
Binary search
• execution needs to compare the element to be searched with the
present element at the center of the list.
• If it matches, then the search is successful otherwise the list is
divided into two halves:
• one from the 0th element to the middle element which is the
center element (first half)
• another from the center element to the last element (which is the
2nd half) where all values are greater than the center element.
• proceeds from either of the two halves depending upon whether the
target element is greater or smaller than the central element.
• If the element is smaller than the central element, then searching is
done in the first half, otherwise searching is done in the second half.
Algorithm for Binary Search
• algorithm Binary_Search(list, item)
• Set L to 0 and R to n: 1
• if L > R, then Binary_Search terminates as unsuccessful
• else
• Set m (the position in the mid element) to the floor of (L + R) / 2
• if Am < T, set L to m + 1 and go to step 3
• if Am > T, set R to m: 1 and go to step 3
• Now, Am = T,
• the search is done; return (m)
Binary Search implementation in C
Linear Search and Binary Search
Linear Search and Binary Search

More Related Content

Similar to unit II_2_i.pptx (20)

Presentation
PresentationPresentation
Presentation
zohaib arif
Ìý
Ocw chp6 2searchbinary
Ocw chp6 2searchbinaryOcw chp6 2searchbinary
Ocw chp6 2searchbinary
Prashant Rai
Ìý
DSA Lec 5+6(Search+Sort) (1).pdf
DSA Lec 5+6(Search+Sort) (1).pdfDSA Lec 5+6(Search+Sort) (1).pdf
DSA Lec 5+6(Search+Sort) (1).pdf
MustafaJutt4
Ìý
Searching
SearchingSearching
Searching
Ashim Lamichhane
Ìý
seaching internal 2 ppt
seaching internal 2 pptseaching internal 2 ppt
seaching internal 2 ppt
SubhrasisBiswal1
Ìý
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary search
Zia Ush Shamszaman
Ìý
Searching & Algorithms IN DATA STRUCTURES
Searching & Algorithms IN DATA STRUCTURESSearching & Algorithms IN DATA STRUCTURES
Searching & Algorithms IN DATA STRUCTURES
RAKSHITDOGRA1
Ìý
data_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptxdata_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptx
Mohammed472103
Ìý
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_Sorting.pptx
Searching_Sorting.pptxSearching_Sorting.pptx
Searching_Sorting.pptx
21BD1A058RSahithi
Ìý
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
03446940736
Ìý
Module_1 Linear search search and Bsearch).pptx
Module_1 Linear search search and Bsearch).pptxModule_1 Linear search search and Bsearch).pptx
Module_1 Linear search search and Bsearch).pptx
vidhyapm2
Ìý
cs702 ppt.ppt
cs702 ppt.pptcs702 ppt.ppt
cs702 ppt.ppt
JavedIqbal398171
Ìý
Dsa – data structure and algorithms searching
Dsa – data structure and algorithms   searchingDsa – data structure and algorithms   searching
Dsa – data structure and algorithms searching
sajinis3
Ìý
programming in C
programming in Cprogramming in C
programming in C
ADITHYAM19
Ìý
Data Structure & Algorithms - Operations
Data Structure & Algorithms - OperationsData Structure & Algorithms - Operations
Data Structure & Algorithms - Operations
babuk110
Ìý
1.4 Sorting.pptx
1.4 Sorting.pptx1.4 Sorting.pptx
1.4 Sorting.pptx
Sujan527908
Ìý
Binary search algorithm.pptx
Binary search  algorithm.pptxBinary search  algorithm.pptx
Binary search algorithm.pptx
bhuvansaachi18
Ìý
Searching and Sorting Algorithms in Data Structures
Searching and Sorting Algorithms  in Data StructuresSearching and Sorting Algorithms  in Data Structures
Searching and Sorting Algorithms in Data Structures
poongothai11
Ìý
Presentation
PresentationPresentation
Presentation
zohaib arif
Ìý
Ocw chp6 2searchbinary
Ocw chp6 2searchbinaryOcw chp6 2searchbinary
Ocw chp6 2searchbinary
Prashant Rai
Ìý
DSA Lec 5+6(Search+Sort) (1).pdf
DSA Lec 5+6(Search+Sort) (1).pdfDSA Lec 5+6(Search+Sort) (1).pdf
DSA Lec 5+6(Search+Sort) (1).pdf
MustafaJutt4
Ìý
seaching internal 2 ppt
seaching internal 2 pptseaching internal 2 ppt
seaching internal 2 ppt
SubhrasisBiswal1
Ìý
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary search
Zia Ush Shamszaman
Ìý
Searching & Algorithms IN DATA STRUCTURES
Searching & Algorithms IN DATA STRUCTURESSearching & Algorithms IN DATA STRUCTURES
Searching & Algorithms IN DATA STRUCTURES
RAKSHITDOGRA1
Ìý
data_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptxdata_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptx
Mohammed472103
Ìý
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_Sorting.pptx
Searching_Sorting.pptxSearching_Sorting.pptx
Searching_Sorting.pptx
21BD1A058RSahithi
Ìý
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
03446940736
Ìý
Module_1 Linear search search and Bsearch).pptx
Module_1 Linear search search and Bsearch).pptxModule_1 Linear search search and Bsearch).pptx
Module_1 Linear search search and Bsearch).pptx
vidhyapm2
Ìý
Dsa – data structure and algorithms searching
Dsa – data structure and algorithms   searchingDsa – data structure and algorithms   searching
Dsa – data structure and algorithms searching
sajinis3
Ìý
programming in C
programming in Cprogramming in C
programming in C
ADITHYAM19
Ìý
Data Structure & Algorithms - Operations
Data Structure & Algorithms - OperationsData Structure & Algorithms - Operations
Data Structure & Algorithms - Operations
babuk110
Ìý
1.4 Sorting.pptx
1.4 Sorting.pptx1.4 Sorting.pptx
1.4 Sorting.pptx
Sujan527908
Ìý
Binary search algorithm.pptx
Binary search  algorithm.pptxBinary search  algorithm.pptx
Binary search algorithm.pptx
bhuvansaachi18
Ìý
Searching and Sorting Algorithms in Data Structures
Searching and Sorting Algorithms  in Data StructuresSearching and Sorting Algorithms  in Data Structures
Searching and Sorting Algorithms in Data Structures
poongothai11
Ìý

More from HODElex (7)

Unit 4_Network Layer_Part II.pptx
Unit 4_Network Layer_Part II.pptxUnit 4_Network Layer_Part II.pptx
Unit 4_Network Layer_Part II.pptx
HODElex
Ìý
Unit VI - Graphs.ppt
Unit VI - Graphs.pptUnit VI - Graphs.ppt
Unit VI - Graphs.ppt
HODElex
Ìý
IEEE and Lower Level LAN Protocols.ppt
IEEE and Lower Level LAN Protocols.pptIEEE and Lower Level LAN Protocols.ppt
IEEE and Lower Level LAN Protocols.ppt
HODElex
Ìý
I & E Tutorials.pdf
I & E Tutorials.pdfI & E Tutorials.pdf
I & E Tutorials.pdf
HODElex
Ìý
wireless lan presentation.ppt
wireless lan presentation.pptwireless lan presentation.ppt
wireless lan presentation.ppt
HODElex
Ìý
Unit II_Searching and Sorting Algorithms.ppt
Unit II_Searching and Sorting Algorithms.pptUnit II_Searching and Sorting Algorithms.ppt
Unit II_Searching and Sorting Algorithms.ppt
HODElex
Ìý
Unit 3_Network Layer_Part II.pptx
Unit 3_Network Layer_Part II.pptxUnit 3_Network Layer_Part II.pptx
Unit 3_Network Layer_Part II.pptx
HODElex
Ìý
Unit 4_Network Layer_Part II.pptx
Unit 4_Network Layer_Part II.pptxUnit 4_Network Layer_Part II.pptx
Unit 4_Network Layer_Part II.pptx
HODElex
Ìý
Unit VI - Graphs.ppt
Unit VI - Graphs.pptUnit VI - Graphs.ppt
Unit VI - Graphs.ppt
HODElex
Ìý
IEEE and Lower Level LAN Protocols.ppt
IEEE and Lower Level LAN Protocols.pptIEEE and Lower Level LAN Protocols.ppt
IEEE and Lower Level LAN Protocols.ppt
HODElex
Ìý
I & E Tutorials.pdf
I & E Tutorials.pdfI & E Tutorials.pdf
I & E Tutorials.pdf
HODElex
Ìý
wireless lan presentation.ppt
wireless lan presentation.pptwireless lan presentation.ppt
wireless lan presentation.ppt
HODElex
Ìý
Unit II_Searching and Sorting Algorithms.ppt
Unit II_Searching and Sorting Algorithms.pptUnit II_Searching and Sorting Algorithms.ppt
Unit II_Searching and Sorting Algorithms.ppt
HODElex
Ìý
Unit 3_Network Layer_Part II.pptx
Unit 3_Network Layer_Part II.pptxUnit 3_Network Layer_Part II.pptx
Unit 3_Network Layer_Part II.pptx
HODElex
Ìý

Recently uploaded (20)

Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
J. Agricultural Machinery
Ìý
04 MAINTENANCE OF CONCRETE PAVEMENTS.ppt
04  MAINTENANCE OF CONCRETE PAVEMENTS.ppt04  MAINTENANCE OF CONCRETE PAVEMENTS.ppt
04 MAINTENANCE OF CONCRETE PAVEMENTS.ppt
sreenath seenu
Ìý
Best KNow Hydrogen Fuel Production in the World The cost in USD kwh for H2
Best KNow  Hydrogen Fuel Production in the World The cost in USD kwh for H2Best KNow  Hydrogen Fuel Production in the World The cost in USD kwh for H2
Best KNow Hydrogen Fuel Production in the World The cost in USD kwh for H2
Daniel Donatelli
Ìý
health safety and environment presentation
health safety and environment presentationhealth safety and environment presentation
health safety and environment presentation
ssuserc606c7
Ìý
US Patented ReGenX Generator, ReGen-X Quatum Motor EV Regenerative Accelerati...
US Patented ReGenX Generator, ReGen-X Quatum Motor EV Regenerative Accelerati...US Patented ReGenX Generator, ReGen-X Quatum Motor EV Regenerative Accelerati...
US Patented ReGenX Generator, ReGen-X Quatum Motor EV Regenerative Accelerati...
Thane Heins NOBEL PRIZE WINNING ENERGY RESEARCHER
Ìý
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptxThe Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
AkankshaRawat75
Ìý
decarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptxdecarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptx
gonzalezolabarriaped
Ìý
Introduction to Safety, Health & Environment
Introduction to Safety, Health  & EnvironmentIntroduction to Safety, Health  & Environment
Introduction to Safety, Health & Environment
ssuserc606c7
Ìý
Embedded System intro Embedded System intro.ppt
Embedded System intro Embedded System intro.pptEmbedded System intro Embedded System intro.ppt
Embedded System intro Embedded System intro.ppt
23ucc580
Ìý
Mathematics_behind_machine_learning_INT255.pptx
Mathematics_behind_machine_learning_INT255.pptxMathematics_behind_machine_learning_INT255.pptx
Mathematics_behind_machine_learning_INT255.pptx
ppkmurthy2006
Ìý
Cloud Computing concepts and technologies
Cloud Computing concepts and technologiesCloud Computing concepts and technologies
Cloud Computing concepts and technologies
ssuser4c9444
Ìý
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
slayshadow705
Ìý
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptxMathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
ppkmurthy2006
Ìý
TM-ASP-101-RF_Air Press manual crimping machine.pdf
TM-ASP-101-RF_Air Press manual crimping machine.pdfTM-ASP-101-RF_Air Press manual crimping machine.pdf
TM-ASP-101-RF_Air Press manual crimping machine.pdf
ChungLe60
Ìý
CS3451-OPERATING-SYSTEM NOTES ALL123.pdf
CS3451-OPERATING-SYSTEM NOTES ALL123.pdfCS3451-OPERATING-SYSTEM NOTES ALL123.pdf
CS3451-OPERATING-SYSTEM NOTES ALL123.pdf
PonniS7
Ìý
US Patented ReGenX Generator, ReGen-X Quatum Motor EV Regenerative Accelerati...
US Patented ReGenX Generator, ReGen-X Quatum Motor EV Regenerative Accelerati...US Patented ReGenX Generator, ReGen-X Quatum Motor EV Regenerative Accelerati...
US Patented ReGenX Generator, ReGen-X Quatum Motor EV Regenerative Accelerati...
Thane Heins NOBEL PRIZE WINNING ENERGY RESEARCHER
Ìý
G8 mini project for alcohol detection and engine lock system with GPS tracki...
G8 mini project for  alcohol detection and engine lock system with GPS tracki...G8 mini project for  alcohol detection and engine lock system with GPS tracki...
G8 mini project for alcohol detection and engine lock system with GPS tracki...
sahillanjewar294
Ìý
Turbocor Product and Technology Review.pdf
Turbocor Product and Technology Review.pdfTurbocor Product and Technology Review.pdf
Turbocor Product and Technology Review.pdf
Totok Sulistiyanto
Ìý
Wireless-Charger presentation for seminar .pdf
Wireless-Charger presentation for seminar .pdfWireless-Charger presentation for seminar .pdf
Wireless-Charger presentation for seminar .pdf
AbhinandanMishra30
Ìý
Env and Water Supply Engg._Dr. Hasan.pdf
Env and Water Supply Engg._Dr. Hasan.pdfEnv and Water Supply Engg._Dr. Hasan.pdf
Env and Water Supply Engg._Dr. Hasan.pdf
MahmudHasan747870
Ìý
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
Optimization of Cumulative Energy, Exergy Consumption and Environmental Life ...
J. Agricultural Machinery
Ìý
04 MAINTENANCE OF CONCRETE PAVEMENTS.ppt
04  MAINTENANCE OF CONCRETE PAVEMENTS.ppt04  MAINTENANCE OF CONCRETE PAVEMENTS.ppt
04 MAINTENANCE OF CONCRETE PAVEMENTS.ppt
sreenath seenu
Ìý
Best KNow Hydrogen Fuel Production in the World The cost in USD kwh for H2
Best KNow  Hydrogen Fuel Production in the World The cost in USD kwh for H2Best KNow  Hydrogen Fuel Production in the World The cost in USD kwh for H2
Best KNow Hydrogen Fuel Production in the World The cost in USD kwh for H2
Daniel Donatelli
Ìý
health safety and environment presentation
health safety and environment presentationhealth safety and environment presentation
health safety and environment presentation
ssuserc606c7
Ìý
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptxThe Golden Gate Bridge a structural marvel inspired by mother nature.pptx
The Golden Gate Bridge a structural marvel inspired by mother nature.pptx
AkankshaRawat75
Ìý
decarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptxdecarbonization steel industry rev1.pptx
decarbonization steel industry rev1.pptx
gonzalezolabarriaped
Ìý
Introduction to Safety, Health & Environment
Introduction to Safety, Health  & EnvironmentIntroduction to Safety, Health  & Environment
Introduction to Safety, Health & Environment
ssuserc606c7
Ìý
Embedded System intro Embedded System intro.ppt
Embedded System intro Embedded System intro.pptEmbedded System intro Embedded System intro.ppt
Embedded System intro Embedded System intro.ppt
23ucc580
Ìý
Mathematics_behind_machine_learning_INT255.pptx
Mathematics_behind_machine_learning_INT255.pptxMathematics_behind_machine_learning_INT255.pptx
Mathematics_behind_machine_learning_INT255.pptx
ppkmurthy2006
Ìý
Cloud Computing concepts and technologies
Cloud Computing concepts and technologiesCloud Computing concepts and technologies
Cloud Computing concepts and technologies
ssuser4c9444
Ìý
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
Structural QA/QC Inspection in KRP 401600 | Copper Processing Plant-3 (MOF-3)...
slayshadow705
Ìý
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptxMathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
Mathematics behind machine learning INT255 INT255__Unit 3__PPT-1.pptx
ppkmurthy2006
Ìý
TM-ASP-101-RF_Air Press manual crimping machine.pdf
TM-ASP-101-RF_Air Press manual crimping machine.pdfTM-ASP-101-RF_Air Press manual crimping machine.pdf
TM-ASP-101-RF_Air Press manual crimping machine.pdf
ChungLe60
Ìý
CS3451-OPERATING-SYSTEM NOTES ALL123.pdf
CS3451-OPERATING-SYSTEM NOTES ALL123.pdfCS3451-OPERATING-SYSTEM NOTES ALL123.pdf
CS3451-OPERATING-SYSTEM NOTES ALL123.pdf
PonniS7
Ìý
G8 mini project for alcohol detection and engine lock system with GPS tracki...
G8 mini project for  alcohol detection and engine lock system with GPS tracki...G8 mini project for  alcohol detection and engine lock system with GPS tracki...
G8 mini project for alcohol detection and engine lock system with GPS tracki...
sahillanjewar294
Ìý
Turbocor Product and Technology Review.pdf
Turbocor Product and Technology Review.pdfTurbocor Product and Technology Review.pdf
Turbocor Product and Technology Review.pdf
Totok Sulistiyanto
Ìý
Wireless-Charger presentation for seminar .pdf
Wireless-Charger presentation for seminar .pdfWireless-Charger presentation for seminar .pdf
Wireless-Charger presentation for seminar .pdf
AbhinandanMishra30
Ìý
Env and Water Supply Engg._Dr. Hasan.pdf
Env and Water Supply Engg._Dr. Hasan.pdfEnv and Water Supply Engg._Dr. Hasan.pdf
Env and Water Supply Engg._Dr. Hasan.pdf
MahmudHasan747870
Ìý

unit II_2_i.pptx

  • 1. Searching methods • is an operation or a technique that helps finds the place of a given element or value in the list. • are designed to check for an element or retrieve an element from any data structure where it is stored. • is said to be successful or unsuccessful depending upon whether the element that is being searched is found or not. • standard techniques • Sequential Search • Interval Search
  • 2. Linear Search • simplest method for searching • defined as a sequential search algorithm • starts at one end and goes through each element of a list until the desired element is found • otherwise the search continues till the end of the data set
  • 3. Linear Search • Given an array arr[] of N elements, the task is to write a function to search a given element x in arr[]. • Iterate from 0 to N-1 and compare the value of every index with x if they match return index.
  • 4. Steps for Linear Search • Start from the leftmost element of arr[] and one by one compare x with each element of arr[] • If x matches with an element, return the index. • If x doesn’t match with any of the elements, return -1.
  • 5. Algorithm for Linear Search • algorithm Seqnl_Search(list, item) • Pre: list != ; • Post: return the index of the item if found, otherwise: 1 • index <- fi • while index < list.Cnt and list[index] != item //cnt: counter variable • index <- index + 1 • end while • if index < list.Cnt and list[index] = item • return index • end if • return: 1
  • 7. Binary search • is a very fast and efficient searching technique. • requires the list to be in sorted order.
  • 8. Binary search • execution needs to compare the element to be searched with the present element at the center of the list. • If it matches, then the search is successful otherwise the list is divided into two halves: • one from the 0th element to the middle element which is the center element (first half) • another from the center element to the last element (which is the 2nd half) where all values are greater than the center element. • proceeds from either of the two halves depending upon whether the target element is greater or smaller than the central element. • If the element is smaller than the central element, then searching is done in the first half, otherwise searching is done in the second half.
  • 9. Algorithm for Binary Search • algorithm Binary_Search(list, item) • Set L to 0 and R to n: 1 • if L > R, then Binary_Search terminates as unsuccessful • else • Set m (the position in the mid element) to the floor of (L + R) / 2 • if Am < T, set L to m + 1 and go to step 3 • if Am > T, set R to m: 1 and go to step 3 • Now, Am = T, • the search is done; return (m)
  • 11. Linear Search and Binary Search
  • 12. Linear Search and Binary Search