Search Header Logo
Edexcel Algorithm efficiency

Edexcel Algorithm efficiency

Assessment

Presentation

•

Computers

•

9th Grade

•

Practice Problem

•

Hard

Created by

Roy Duguid

FREE Resource

24 Slides • 7 Questions

1

Do Now

Create a list with 3 people in it
add a new person to the end of the list
print the list
remove the last person from the list
replace the 2nd person in the list with "Mario"
print the list
print the list but use [-1] .

Stretch:
keep asking the user if they want to add a new person to the list until they say no. add each person to the list and print the list

2

​Algorithm Efficiency

:D

3

Teams > Topic 1 > Algorithm Efficiency

4

media

5

​Time – how long it takes to run (often measured in terms of the number of steps or operations). Space – how much memory it uses during execution.

6

media

7

media

8

media

9

media

10

media
​Best case: 1 comparison
Worst Case: 100 comparisons

11

Multiple Choice

State the best case for a linear search algorithm.

1
The best case for a linear search algorithm occurs when the target element is the first element in the list.
2
The best case occurs when the target element is in the middle of the list.
3
The best case occurs when the list is empty.
4
The best case occurs when the target element is the last element in the list.

12

Multiple Choice

State the worst case for a linear search algorithm.

1
The worst case occurs when the list is sorted in ascending order.
2
The worst case occurs when the target element is at the first position in the list.
3
The worst case occurs when the target element is not present or is at the last position in the list.
4
The worst case occurs when the list is empty.

13

media

14

media

15

media

16

media

17

media

18

media

19

media

20

media

21

Multiple Choice

Explain the best case search for a binary search

1
The best case occurs when the target is at the beginning of the array.
2
The best case occurs when the target is at the end of the array.
3
The best case occurs when the array is empty.
4
The best case occurs when the target is at the midpoint of the array.

22

Multiple Select

In the worst-case scenario for a binary search...
(multiple choiuce

1

it takes the maximum number of steps

2

the target isn't in the list

3

the target it in the middle

4

it find the target immediately

23

media

24

media

25

media

26

media

27

Multiple Choice

Describe an in-place algorithm

1
An in-place algorithm modifies data directly without using extra space proportional to the input size.
2
An in-place algorithm can only be applied to sorted data.
3
An in-place algorithm creates a copy of the data before modification.
4
An in-place algorithm requires additional memory for processing.

28

Multiple Choice

Describe an out-of-place algorithm

1
An out-of-place algorithm is one that requires additional memory space and does not modify the input data in place.
2
An out-of-place algorithm sorts data in a single pass without extra memory.
3
An out-of-place algorithm is one that runs in constant space and time.
4
An out-of-place algorithm modifies the input data directly.

29

Open Ended

Explain the effect on efficiency of using a merge sort algorithm instead of a bubble sort algorithm on this list: 9     4     3     5     5     1     7

(2 marks)

30

​merge will use more memory 1 because it will make copies of the list 1 the bubble will use less memory 1 because it is an in-place 1 sort the merge will take more time to write and debug 1 because it is a more complex algorithm 1 the bubble will probably take less time to write 1 because it is simple / well known 1

31

Teams - Task 1
pattern-tertiary

Do Now

Create a list with 3 people in it
add a new person to the end of the list
print the list
remove the last person from the list
replace the 2nd person in the list with "Mario"
print the list
print the list but use [-1] .

Stretch:
keep asking the user if they want to add a new person to the list until they say no. add each person to the list and print the list

Show answer

Auto Play

Slide 1 / 31

SLIDE