際際滷

際際滷Share a Scribd company logo
OBJECTIVE OF PRESENTATION
 Define Binary search.
 Example and solve with Binary search.
Binary search
 Binary search is a fast search algorithm with run-time complexity.
 This search algorithm works on the principle of divide and conquer.
 For this algorithm to work properly, the data collection should be in the
sorted form.
 Binary search looks for a particular item by comparing the middle most
item of the collection.
Algorithm of Binary search
It can be done by the following step:
1. get the middle element
MID= INT((BEG+END)/2)
2. if the middle element equals to the searched value, the algorithm stops.
3.Otherwise
a)If Item<DATA[MID],then appear left half
DATA[BEG].DATA[MID-1]
b)If item>DATA[MID],then appear right half
DATA[BEG].DATA[MID+1]
EXAMPLE
Let DATA be the following sorted 10 element array:
DATA: 2,5,8,12,16,23,38,56,72,91
Find ITEM=23.
End of the presentation
Thank You

More Related Content

What's hot (20)

Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
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
single linked list
single linked listsingle linked list
single linked list
Sathasivam Rangasamy
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
Sowmya Jyothi
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)
Home
Linked list
Linked listLinked list
Linked list
akshat360
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
SHAKOOR AB
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
Adam Mukharil Bachtiar
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
International Islamic University
Binary Tree Traversal
Binary Tree TraversalBinary Tree Traversal
Binary Tree Traversal
Dhrumil Panchal
Linked list
Linked listLinked list
Linked list
KalaivaniKS1
Hashing
HashingHashing
Hashing
Amar Jukuntla
Arrays
ArraysArrays
Arrays
SARITHA REDDY
Linked list
Linked listLinked list
Linked list
Trupti Agrawal
Bubble sort | Data structure |
Bubble sort | Data structure |Bubble sort | Data structure |
Bubble sort | Data structure |
MdSaiful14
Priority queues
Priority queuesPriority queues
Priority queues
Priyanka Rana
Applications of stack
Applications of stackApplications of stack
Applications of stack
eShikshak
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
Raj Naik
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
NalinNishant3
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
Kevin Jadiya
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
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
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
Sowmya Jyothi
Data Structures : hashing (1)
Data Structures : hashing (1)Data Structures : hashing (1)
Data Structures : hashing (1)
Home
Linked list
Linked listLinked list
Linked list
akshat360
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
SHAKOOR AB
Binary Tree Traversal
Binary Tree TraversalBinary Tree Traversal
Binary Tree Traversal
Dhrumil Panchal
Bubble sort | Data structure |
Bubble sort | Data structure |Bubble sort | Data structure |
Bubble sort | Data structure |
MdSaiful14
Applications of stack
Applications of stackApplications of stack
Applications of stack
eShikshak
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
Raj Naik
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
NalinNishant3
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
Kevin Jadiya

Similar to Binary search in data structure (20)

Optimal Binary Search tree ppt seminar.pptx
Optimal Binary Search tree ppt seminar.pptxOptimal Binary Search tree ppt seminar.pptx
Optimal Binary Search tree ppt seminar.pptx
ssusered44c8
IRJET- A Survey on Different Searching Algorithms
IRJET- A Survey on Different Searching AlgorithmsIRJET- A Survey on Different Searching Algorithms
IRJET- A Survey on Different Searching Algorithms
IRJET Journal
Data analysis and algorithms - UNIT 2.pptx
Data analysis and algorithms - UNIT 2.pptxData analysis and algorithms - UNIT 2.pptx
Data analysis and algorithms - UNIT 2.pptx
sgrishma559
Rahat &amp; juhith
Rahat &amp; juhithRahat &amp; juhith
Rahat &amp; juhith
Rj Juhith
Array 2
Array 2Array 2
Array 2
Abbott
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 & Algorithms - Lecture 2
Data Structures & Algorithms - Lecture 2Data Structures & Algorithms - Lecture 2
Data Structures & Algorithms - Lecture 2
Faculty of Computers and Informatics, Suez Canal University, Ismailia, Egypt
Unit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTINGUnit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTING
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
Ocw chp6 2searchbinary
Ocw chp6 2searchbinaryOcw chp6 2searchbinary
Ocw chp6 2searchbinary
Prashant Rai
Binary Search.pptx
Binary Search.pptxBinary Search.pptx
Binary Search.pptx
SheherBano57
Unit- 2_my1.pdf jbvjwe vbeijv dv d d d kjd k
Unit- 2_my1.pdf jbvjwe vbeijv dv d  d d kjd kUnit- 2_my1.pdf jbvjwe vbeijv dv d  d d kjd k
Unit- 2_my1.pdf jbvjwe vbeijv dv d d d kjd k
bhattkathit123
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...
AntareepMajumder
Lecture#1(Algorithmic Notations).ppt
Lecture#1(Algorithmic Notations).pptLecture#1(Algorithmic Notations).ppt
Lecture#1(Algorithmic Notations).ppt
MuhammadTalhaAwan1
Data Structure and Algorithms Arrays
Data Structure and Algorithms ArraysData Structure and Algorithms Arrays
Data Structure and Algorithms Arrays
ManishPrajapati78
Mastering on Divide and Conquer Algorithm
Mastering on Divide and Conquer AlgorithmMastering on Divide and Conquer Algorithm
Mastering on Divide and Conquer Algorithm
Mahmud Hasan Tanvir
ARRAY in python and c with examples .pptx
ARRAY  in python and c with examples .pptxARRAY  in python and c with examples .pptx
ARRAY in python and c with examples .pptx
abhishekmaurya102515
Associative Learning
Associative LearningAssociative Learning
Associative Learning
Indrajit Sreemany
COMPUTER PROGRAMMING UNIT 1 Lecture 6
COMPUTER PROGRAMMING UNIT 1 Lecture 6COMPUTER PROGRAMMING UNIT 1 Lecture 6
COMPUTER PROGRAMMING UNIT 1 Lecture 6
Vishal Patil
Introduction to Datamining Concept and Techniques
Introduction to Datamining Concept and TechniquesIntroduction to Datamining Concept and Techniques
Introduction to Datamining Concept and Techniques
S董n C嘆m Nhom
Updated Lab3.docx
Updated Lab3.docxUpdated Lab3.docx
Updated Lab3.docx
AleezaAnjum
Optimal Binary Search tree ppt seminar.pptx
Optimal Binary Search tree ppt seminar.pptxOptimal Binary Search tree ppt seminar.pptx
Optimal Binary Search tree ppt seminar.pptx
ssusered44c8
IRJET- A Survey on Different Searching Algorithms
IRJET- A Survey on Different Searching AlgorithmsIRJET- A Survey on Different Searching Algorithms
IRJET- A Survey on Different Searching Algorithms
IRJET Journal
Data analysis and algorithms - UNIT 2.pptx
Data analysis and algorithms - UNIT 2.pptxData analysis and algorithms - UNIT 2.pptx
Data analysis and algorithms - UNIT 2.pptx
sgrishma559
Rahat &amp; juhith
Rahat &amp; juhithRahat &amp; juhith
Rahat &amp; juhith
Rj Juhith
Array 2
Array 2Array 2
Array 2
Abbott
data_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptxdata_structure_Chapter two_computer.pptx
data_structure_Chapter two_computer.pptx
Mohammed472103
Ocw chp6 2searchbinary
Ocw chp6 2searchbinaryOcw chp6 2searchbinary
Ocw chp6 2searchbinary
Prashant Rai
Binary Search.pptx
Binary Search.pptxBinary Search.pptx
Binary Search.pptx
SheherBano57
Unit- 2_my1.pdf jbvjwe vbeijv dv d d d kjd k
Unit- 2_my1.pdf jbvjwe vbeijv dv d  d d kjd kUnit- 2_my1.pdf jbvjwe vbeijv dv d  d d kjd k
Unit- 2_my1.pdf jbvjwe vbeijv dv d d d kjd k
bhattkathit123
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...
AntareepMajumder
Lecture#1(Algorithmic Notations).ppt
Lecture#1(Algorithmic Notations).pptLecture#1(Algorithmic Notations).ppt
Lecture#1(Algorithmic Notations).ppt
MuhammadTalhaAwan1
Data Structure and Algorithms Arrays
Data Structure and Algorithms ArraysData Structure and Algorithms Arrays
Data Structure and Algorithms Arrays
ManishPrajapati78
Mastering on Divide and Conquer Algorithm
Mastering on Divide and Conquer AlgorithmMastering on Divide and Conquer Algorithm
Mastering on Divide and Conquer Algorithm
Mahmud Hasan Tanvir
ARRAY in python and c with examples .pptx
ARRAY  in python and c with examples .pptxARRAY  in python and c with examples .pptx
ARRAY in python and c with examples .pptx
abhishekmaurya102515
COMPUTER PROGRAMMING UNIT 1 Lecture 6
COMPUTER PROGRAMMING UNIT 1 Lecture 6COMPUTER PROGRAMMING UNIT 1 Lecture 6
COMPUTER PROGRAMMING UNIT 1 Lecture 6
Vishal Patil
Introduction to Datamining Concept and Techniques
Introduction to Datamining Concept and TechniquesIntroduction to Datamining Concept and Techniques
Introduction to Datamining Concept and Techniques
S董n C嘆m Nhom
Updated Lab3.docx
Updated Lab3.docxUpdated Lab3.docx
Updated Lab3.docx
AleezaAnjum

More from Meherul1234 (8)

Breadth-first search in alogorithm
Breadth-first search in alogorithmBreadth-first search in alogorithm
Breadth-first search in alogorithm
Meherul1234
Recursion in data structure
Recursion in data structureRecursion in data structure
Recursion in data structure
Meherul1234
Transistor in electronics
Transistor in electronicsTransistor in electronics
Transistor in electronics
Meherul1234
The bus interface unit (biu)
The bus interface unit (biu)The bus interface unit (biu)
The bus interface unit (biu)
Meherul1234
Decision tree in System Design
Decision tree in System DesignDecision tree in System Design
Decision tree in System Design
Meherul1234
Analog to analog conversion
Analog to analog conversionAnalog to analog conversion
Analog to analog conversion
Meherul1234
Programmable Peripheral Interface
Programmable Peripheral InterfaceProgrammable Peripheral Interface
Programmable Peripheral Interface
Meherul1234
Error handling
Error handlingError handling
Error handling
Meherul1234
Breadth-first search in alogorithm
Breadth-first search in alogorithmBreadth-first search in alogorithm
Breadth-first search in alogorithm
Meherul1234
Recursion in data structure
Recursion in data structureRecursion in data structure
Recursion in data structure
Meherul1234
Transistor in electronics
Transistor in electronicsTransistor in electronics
Transistor in electronics
Meherul1234
The bus interface unit (biu)
The bus interface unit (biu)The bus interface unit (biu)
The bus interface unit (biu)
Meherul1234
Decision tree in System Design
Decision tree in System DesignDecision tree in System Design
Decision tree in System Design
Meherul1234
Analog to analog conversion
Analog to analog conversionAnalog to analog conversion
Analog to analog conversion
Meherul1234
Programmable Peripheral Interface
Programmable Peripheral InterfaceProgrammable Peripheral Interface
Programmable Peripheral Interface
Meherul1234
Error handling
Error handlingError handling
Error handling
Meherul1234

Recently uploaded (20)

Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdfBlind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Ajaz Hussain
TLE 7 - 2nd Topic - Codes and Standards in Industrial Arts Services.pptx
TLE 7 - 2nd Topic - Codes and Standards in Industrial Arts Services.pptxTLE 7 - 2nd Topic - Codes and Standards in Industrial Arts Services.pptx
TLE 7 - 2nd Topic - Codes and Standards in Industrial Arts Services.pptx
RizaBedayo
Principle and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby BasnetPrinciple and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby Basnet
Boby Basnet
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷sHow to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
Celine George
Useful environment methods in Odoo 18 - Odoo 際際滷s
Useful environment methods in Odoo 18 - Odoo 際際滷sUseful environment methods in Odoo 18 - Odoo 際際滷s
Useful environment methods in Odoo 18 - Odoo 際際滷s
Celine George
APM People Interest Network Conference - Tim Lyons - The neurological levels ...
APM People Interest Network Conference - Tim Lyons - The neurological levels ...APM People Interest Network Conference - Tim Lyons - The neurological levels ...
APM People Interest Network Conference - Tim Lyons - The neurological levels ...
Association for Project Management
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
Association for Project Management
QuickBooks Desktop to QuickBooks Online How to Make the Move
QuickBooks Desktop to QuickBooks Online  How to Make the MoveQuickBooks Desktop to QuickBooks Online  How to Make the Move
QuickBooks Desktop to QuickBooks Online How to Make the Move
TechSoup
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
sandynavergas1
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
A PPT Presentation on The Princess and the God: A tale of ancient India  by A...A PPT Presentation on The Princess and the God: A tale of ancient India  by A...
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
Beena E S
Digital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptxDigital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptx
Dr. Sarita Anand
Storytelling instructions...............
Storytelling instructions...............Storytelling instructions...............
Storytelling instructions...............
Alexander Benito
The Broccoli Dog's inner voice (look A)
The Broccoli Dog's inner voice  (look A)The Broccoli Dog's inner voice  (look A)
The Broccoli Dog's inner voice (look A)
merasan
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
Kaun TALHA quiz Finals -- El Dorado 2025
Kaun TALHA quiz Finals -- El Dorado 2025Kaun TALHA quiz Finals -- El Dorado 2025
Kaun TALHA quiz Finals -- El Dorado 2025
Conquiztadors- the Quiz Society of Sri Venkateswara College
TRANSFER OF PATIENTS IN HOSPITAL SETTING.pptx
TRANSFER OF PATIENTS IN HOSPITAL SETTING.pptxTRANSFER OF PATIENTS IN HOSPITAL SETTING.pptx
TRANSFER OF PATIENTS IN HOSPITAL SETTING.pptx
PoojaSen20
A PPT on the First Three chapters of Wings of Fire
A PPT on the First Three chapters of Wings of FireA PPT on the First Three chapters of Wings of Fire
A PPT on the First Three chapters of Wings of Fire
Beena E S
N.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity BriefingN.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity Briefing
Mebane Rash
EDL 290F Week 3 - Mountaintop Views (2025).pdf
EDL 290F Week 3  - Mountaintop Views (2025).pdfEDL 290F Week 3  - Mountaintop Views (2025).pdf
EDL 290F Week 3 - Mountaintop Views (2025).pdf
Liz Walsh-Trevino
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdfBlind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Ajaz Hussain
TLE 7 - 2nd Topic - Codes and Standards in Industrial Arts Services.pptx
TLE 7 - 2nd Topic - Codes and Standards in Industrial Arts Services.pptxTLE 7 - 2nd Topic - Codes and Standards in Industrial Arts Services.pptx
TLE 7 - 2nd Topic - Codes and Standards in Industrial Arts Services.pptx
RizaBedayo
Principle and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby BasnetPrinciple and Practices of Animal Breeding || Boby Basnet
Principle and Practices of Animal Breeding || Boby Basnet
Boby Basnet
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷sHow to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
How to Setup WhatsApp in Odoo 17 - Odoo 際際滷s
Celine George
Useful environment methods in Odoo 18 - Odoo 際際滷s
Useful environment methods in Odoo 18 - Odoo 際際滷sUseful environment methods in Odoo 18 - Odoo 際際滷s
Useful environment methods in Odoo 18 - Odoo 際際滷s
Celine George
APM People Interest Network Conference - Tim Lyons - The neurological levels ...
APM People Interest Network Conference - Tim Lyons - The neurological levels ...APM People Interest Network Conference - Tim Lyons - The neurological levels ...
APM People Interest Network Conference - Tim Lyons - The neurological levels ...
Association for Project Management
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
APM People Interest Network Conference - Oliver Randall & David Bovis - Own Y...
Association for Project Management
QuickBooks Desktop to QuickBooks Online How to Make the Move
QuickBooks Desktop to QuickBooks Online  How to Make the MoveQuickBooks Desktop to QuickBooks Online  How to Make the Move
QuickBooks Desktop to QuickBooks Online How to Make the Move
TechSoup
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
Eng7-Q4-Lesson 1 Part 1 Understanding Discipline-Specific Words, Voice, and T...
sandynavergas1
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
A PPT Presentation on The Princess and the God: A tale of ancient India  by A...A PPT Presentation on The Princess and the God: A tale of ancient India  by A...
A PPT Presentation on The Princess and the God: A tale of ancient India by A...
Beena E S
Digital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptxDigital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptx
Dr. Sarita Anand
Storytelling instructions...............
Storytelling instructions...............Storytelling instructions...............
Storytelling instructions...............
Alexander Benito
The Broccoli Dog's inner voice (look A)
The Broccoli Dog's inner voice  (look A)The Broccoli Dog's inner voice  (look A)
The Broccoli Dog's inner voice (look A)
merasan
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
TRANSFER OF PATIENTS IN HOSPITAL SETTING.pptx
TRANSFER OF PATIENTS IN HOSPITAL SETTING.pptxTRANSFER OF PATIENTS IN HOSPITAL SETTING.pptx
TRANSFER OF PATIENTS IN HOSPITAL SETTING.pptx
PoojaSen20
A PPT on the First Three chapters of Wings of Fire
A PPT on the First Three chapters of Wings of FireA PPT on the First Three chapters of Wings of Fire
A PPT on the First Three chapters of Wings of Fire
Beena E S
N.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity BriefingN.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity Briefing
Mebane Rash
EDL 290F Week 3 - Mountaintop Views (2025).pdf
EDL 290F Week 3  - Mountaintop Views (2025).pdfEDL 290F Week 3  - Mountaintop Views (2025).pdf
EDL 290F Week 3 - Mountaintop Views (2025).pdf
Liz Walsh-Trevino

Binary search in data structure

  • 1. OBJECTIVE OF PRESENTATION Define Binary search. Example and solve with Binary search.
  • 2. Binary search Binary search is a fast search algorithm with run-time complexity. This search algorithm works on the principle of divide and conquer. For this algorithm to work properly, the data collection should be in the sorted form. Binary search looks for a particular item by comparing the middle most item of the collection.
  • 3. Algorithm of Binary search It can be done by the following step: 1. get the middle element MID= INT((BEG+END)/2) 2. if the middle element equals to the searched value, the algorithm stops. 3.Otherwise a)If Item<DATA[MID],then appear left half DATA[BEG].DATA[MID-1] b)If item>DATA[MID],then appear right half DATA[BEG].DATA[MID+1]
  • 4. EXAMPLE Let DATA be the following sorted 10 element array: DATA: 2,5,8,12,16,23,38,56,72,91 Find ITEM=23.
  • 5. End of the presentation Thank You