Submit Search
Upload
Binary search in Python using recursion
•
0 likes
•
327 views
chinthala Vijaya Kumar
Follow
Board : CBSE Class : 12 Subject : Python Concept : Binary search using recursion in Python
Read less
Read more
Education
Report
Share
Report
Share
1 of 33
Download now
Download to read offline
Recommended
1.2 order of operations part 1
1.2 order of operations part 1
bweldon
Lesson 1 student notes
Lesson 1 student notes
Joanne Rosa Crooks
Integers
Integers
Punita Verma
Integers Class 7
Integers Class 7
JiyaWalia
Integer operations
Integer operations
jpietnik
Integers best ppt
Integers best ppt
arivuselvi3
Integers
Integers
Samyak Jain
Integers
Integers
Vanapalli Kumarswamy
Recommended
1.2 order of operations part 1
1.2 order of operations part 1
bweldon
Lesson 1 student notes
Lesson 1 student notes
Joanne Rosa Crooks
Integers
Integers
Punita Verma
Integers Class 7
Integers Class 7
JiyaWalia
Integer operations
Integer operations
jpietnik
Integers best ppt
Integers best ppt
arivuselvi3
Integers
Integers
Samyak Jain
Integers
Integers
Vanapalli Kumarswamy
squares and square roots
squares and square roots
Charchit Art
Chapter 3 Solving By Graph
Chapter 3 Solving By Graph
swartzje
Integers
Integers
TaraCampbell0510
Chapter 2
Chapter 2
jenpenbrad
Integers slideshow
Integers slideshow
JEpic23
Multipying integers
Multipying integers
bweldon
Add-subtract of integers
Add-subtract of integers
Orlando Calderon
Integers and Operation of Integers
Integers and Operation of Integers
Maria Theresa Bicar - Edar
Integers
Integers
Rishabh27
Integers
Integers
NishaMahajan7
Integers
Integers
joycyarmstrong123
Squaring of numbers
Squaring of numbers
Krishna Kumawat
Topic
Topic
FarheenPatel2
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
chinthala Vijaya Kumar
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
chinthala Vijaya Kumar
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
chinthala Vijaya Kumar
Inserting an element in a sorted array using traditional algorithm
Inserting an element in a sorted array using traditional algorithm
chinthala Vijaya Kumar
Linear search python CBSE Class 12
Linear search python CBSE Class 12
chinthala Vijaya Kumar
Data visualization pyplot
Data visualization pyplot
chinthala Vijaya Kumar
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
chinthala Vijaya Kumar
Bubble sort
Bubble sort
chinthala Vijaya Kumar
Python Fundamentals Class 11
Python Fundamentals Class 11
chinthala Vijaya Kumar
More Related Content
What's hot
squares and square roots
squares and square roots
Charchit Art
Chapter 3 Solving By Graph
Chapter 3 Solving By Graph
swartzje
Integers
Integers
TaraCampbell0510
Chapter 2
Chapter 2
jenpenbrad
Integers slideshow
Integers slideshow
JEpic23
Multipying integers
Multipying integers
bweldon
Add-subtract of integers
Add-subtract of integers
Orlando Calderon
Integers and Operation of Integers
Integers and Operation of Integers
Maria Theresa Bicar - Edar
Integers
Integers
Rishabh27
Integers
Integers
NishaMahajan7
Integers
Integers
joycyarmstrong123
Squaring of numbers
Squaring of numbers
Krishna Kumawat
Topic
Topic
FarheenPatel2
What's hot
(13)
squares and square roots
squares and square roots
Chapter 3 Solving By Graph
Chapter 3 Solving By Graph
Integers
Integers
Chapter 2
Chapter 2
Integers slideshow
Integers slideshow
Multipying integers
Multipying integers
Add-subtract of integers
Add-subtract of integers
Integers and Operation of Integers
Integers and Operation of Integers
Integers
Integers
Integers
Integers
Integers
Integers
Squaring of numbers
Squaring of numbers
Topic
Topic
More from chinthala Vijaya Kumar
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
chinthala Vijaya Kumar
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
chinthala Vijaya Kumar
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
chinthala Vijaya Kumar
Inserting an element in a sorted array using traditional algorithm
Inserting an element in a sorted array using traditional algorithm
chinthala Vijaya Kumar
Linear search python CBSE Class 12
Linear search python CBSE Class 12
chinthala Vijaya Kumar
Data visualization pyplot
Data visualization pyplot
chinthala Vijaya Kumar
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
chinthala Vijaya Kumar
Bubble sort
Bubble sort
chinthala Vijaya Kumar
Python Fundamentals Class 11
Python Fundamentals Class 11
chinthala Vijaya Kumar
File handling CBSE CLASS 12
File handling CBSE CLASS 12
chinthala Vijaya Kumar
Recursion CBSE Class 12
Recursion CBSE Class 12
chinthala Vijaya Kumar
More from chinthala Vijaya Kumar
(11)
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
Inserting an element in a sorted array using traditional algorithm
Inserting an element in a sorted array using traditional algorithm
Linear search python CBSE Class 12
Linear search python CBSE Class 12
Data visualization pyplot
Data visualization pyplot
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
Bubble sort
Bubble sort
Python Fundamentals Class 11
Python Fundamentals Class 11
File handling CBSE CLASS 12
File handling CBSE CLASS 12
Recursion CBSE Class 12
Recursion CBSE Class 12
Recently uploaded
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
Nbelano25
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
GangaMaiya1
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
Jisc
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
Dr. Mazin Mohamed alkathiri
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
Celine George
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
neillewis46
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
Celine George
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
Association for Project Management
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
TechSoup
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
Amil baba
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
Marc Dusseiller Dusjagr
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
Nguyen Thanh Tu Collection
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
Nguyen Thanh Tu Collection
Orientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdf
Elizabeth Walsh
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
marlenawright1
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
Jisc
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
EduSkills OECD
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA! .
Colégio Santa Teresinha
Recently uploaded
(20)
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
Orientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdf
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA! .
Binary search in Python using recursion
1.
GVK CHINMAYA VIDYALAYA SENIOR
SECONDARY SCHOOL Kothuru, Indukurupet, SPS Nellore Binary Search Class: 12 Subject: Python Teacher: C Vijaya Kumar B.Tech,MBA
2.
2 3 4
10 40 high>=low: 4>=0 TRUE mid=2 LOW HIGHMID
3.
2 3 4
10 40 If arr[mid]==10: arr[2]==10: 4 = 10 FALSE LOW HIGHMID
4.
2 3 4
10 40 Elif arr[mid]>x: arr[2]>10: 4>10: FALSE LOW HIGHMID
5.
2 3 4
10 40 binary(arr,3,4,10) LOW HIGH
6.
2 3 4
10 40 binary(arr,3,4,10) If high>=low: 4>=3: TRUE mid=3 LOW,MID HIGH
7.
2 3 4
10 40 arr[3]==10 TRUE LOW and MID HIGH
8.
2 3 4
10 40 Mid value is returned here LOW and MID HIGH
9.
2 3 4
10 40 result=3 LOW and MID HIGH
10.
2 3 4
10 40 If 3 not equal to -1: Item found LOW and MID HIGH
11.
Lets us see
the flow of execution of item not found in the same binary search
12.
2 3 4
10 40 HIGHLOW def binary(arr,0,4,41):
13.
2 3 4
10 40 HIGHLOW If 4>=0: TRUE mid=2 MID
14.
2 3 4
10 40 HIGHLOW If 4==41: False MID
15.
2 3 4
10 40 HIGHLOW elif 4 > 41: False MID
16.
2 3 4
10 40 HIGHLOW binary(arr,3,4,41): MID
17.
2 3 4
10 40 HIGHLOW binary(arr,3,4,41):
18.
2 3 4
10 40 HIGHLOW and MID If 4 > 3: TRUE mid=3
19.
2 3 4
10 40 HIGHLOW and MID elif 10 > 41: FALSE
20.
2 3 4
10 40 HIGHLOW and MID binary(arr,4,4,41)
21.
2 3 4
10 40 LOW and HIGH binary(arr,4,4,41)
22.
2 3 4
10 40 MID,LOW and HIGH If 4 >= 4: TRUE Mid = 4
23.
2 3 4
10 40 MID,LOW and HIGH if 40 == 41: FALSE
24.
2 3 4
10 40 MID,LOW and HIGH elif 40 > 41: FALSE
25.
2 3 4
10 40 MID,LOW and HIGH binary (arr,5,4,41):
26.
2 3 4
10 40 HIGH binary (arr,5,4,41): Low = 5 High = 4 X = 41
27.
2 3 4
10 40 HIGH If 4>=5: FALSE
28.
2 3 4
10 40 HIGH Return -1
29.
2 3 4
10 40 HIGH Return -1 (Third Recursive Call)
30.
2 3 4
10 40 HIGH Return -1 (Second recursive call)
31.
2 3 4
10 40 HIGH Return -1 (First recursive call)
32.
2 3 4
10 40 HIGH Result = -1
33.
2 3 4
10 40 HIGH If False: Else print(“element not present in array”)
Download now