What is LessonUp
Search
Channels
Log in
Register
‹
Return to search
12 - Binary search
Binary search
/Division and remainders
1 / 20
next
Slide 1:
Slide
Computing
Upper Secondary (Key Stage 4)
GCSE
This lesson contains
20 slides
, with
interactive quizzes
and
text slides
.
Lesson duration is:
50 min
Start lesson
Save
Share
Print lesson
Items in this lesson
Binary search
/Division and remainders
Slide 1 - Slide
Division and Remainders
/ Division
// Floor Division
% Modulus
Slide 2 - Slide
Predict
Slide 3 - Slide
What do you think the code
will do when run?
Slide 4 - Open question
RUN
Run the code
Slide 5 - Slide
Investigate & Modify
Using /, // and %, calculate the following questions using python
Slide 6 - Slide
What is 703 divided by 34 with no remainder?
A
23
B
22
C
20
D
34
Slide 7 - Quiz
What is the remainder of 703 divided by 34?
A
23
B
22
C
20
D
34
Slide 8 - Quiz
What is 90231 divided by 94?
A
959
B
959.904255319
C
90
D
85
Slide 9 - Quiz
Linear Search
Attempt to code a linear search in Python
Click here for a blank createwithcode
Slide 10 - Slide
Advanced Linear search
Run the code
Slide 11 - Slide
Predict
Slide 12 - Slide
What do you think the code
will do when run?
Slide 13 - Open question
Run
Click here
Slide 14 - Slide
Investigate and Modify
Experiment with altering the target and array's hard-coded values to investigate their effects
Replace the array, to cover a range of 1-10 using two "pointers"
Replace target's hard coded value with a user input.
Slide 15 - Slide
Make
Click here for a blank createwithcode
Create a program to guess a user's number 1-100 with binary search.
You will only tell the program if their number is higher, lower or correct.
Slide 16 - Slide
Number Guesser Code
Click here
Slide 17 - Slide
What is the main advantage of using binary search over linear search?
A
Binary search is eaiser to implement
B
Binary search usually runs faster
C
Binary search works on unsorted data
D
Binary search is more suitable for small datasets
Slide 18 - Quiz
What is the result of 17 % 5?
A
2
B
3
C
4
D
5
Slide 19 - Quiz
In binary search, what is the first step after calculating the midpoint?
A
Check if the midpoint is equal to the target
B
Update the low pointer to the midpoint
C
Update the high pointer to the midpoint.
D
Divide the searrch space into two halves.
Slide 20 - Quiz
More lessons like this
GRADE 4 Module 6 Lesson 3 - Interpret Remainders
June 2024
- Lesson with
13 slides
Binary
September 2024
- Lesson with
27 slides
Dividing Whole Numbers with One-Digit Divisors
May 2024
- Lesson with
18 slides
Math
Primary Education
Age 9
Cracking Remainders: Understanding Division
June 2024
- Lesson with
13 slides
Mastering LCM and HCF
September 2023
- Lesson with
14 slides
Dividing Decimals with Long Division
January 2024
- Lesson with
15 slides
Data Structures Array
March 2023
- Lesson with
38 slides
Computer Science
Secondary Education
Mastering Math: Divisibility Tests
March 2024
- Lesson with
15 slides