Year 11 refine Searching and sorting algorithms

Year 11 refine Searching and sorting algorithms
1 / 17
next
Slide 1: Slide
ComputingUpper Secondary (Key Stage 4)GCSE

This lesson contains 17 slides, with interactive quizzes and text slides.

time-iconLesson duration is: 60 min

Items in this lesson

Year 11 refine Searching and sorting algorithms

Slide 1 - Slide

Slide 2 - Slide

Slide 3 - Slide

Slide 4 - Slide

Name all the searching algorithms you remember?

Slide 5 - Open question

What is a linear search?

Slide 6 - Open question

Slide 7 - Slide

What is a binary search?

Slide 8 - Open question

Slide 9 - Slide

Using a linear search, how many searches will be performed to find 78?

A
2
B
8
C
9
D
4

Slide 10 - Quiz

Using a binary search, how many searches will be performed to find 78?

A
2
B
8
C
9
D
4

Slide 11 - Quiz

In your books or on Word:



  • Draw the list and annotate it for a linear search
  • Order the list to perform a binary search on it and annotate it for a binary search
timer
3:00

Slide 12 - Slide

no
no
no
no
yes
no
no
no
start + len[arr] // 2 (0 + 8 / 2 = 4), middle = 42, Del left half
start + len[arr] // 2 (5 + 8 // 2 = 6), middle = 74, Del left half
start + len[arr] // 2 (7 + 8 // 2 = 7), middle = 78, found 78
Total 3 searches
no higher
no higher
yes

Slide 13 - Slide

What are the pros and cons of both algorithms? Write them in your books, then I will cold call using the random wheel.
timer
3:00

Slide 14 - Slide

Slide 15 - Slide

Slide 16 - Slide

Answers

i) 1 mark each bullet point, 3 total
  • Compare to / pick out middle value (which is 6)
  • Discard only left side // retain only right side (because 6 < 10)…
  • Compare to / pick out (middle value which is) 10

ii) Data must be sorted / in order


Slide 17 - Slide