You are on page 1of 14

Year 10 CS

Exam Prep
18/08/22
Algorithms (Searching and Sorting)
What are the four basic steps of a “BINARY SEARCH ALGORITHM”
Write them below:
1.
2.
3.
4.
Binary search
• Show the steps required to find the number 21 in the string below:
You will need to identify how many step this will take and show me
what the string will look like after each stage:

23,13,24,87,32,65,43,45,21
Linear Search
• List the four steps of a linear search below:

1.
2.
3.
4.
Searching Algorithm
Explain in your own words what would happen when you use a linear
search on this list of data when looking for the number 21.
23,13,24,87,32,65,43,45,21
Searching
Thursday, Aug
Algorithms ust 18, 2022
Recap

Middle,
________ searches are used on ordered lists. They start from the Found,
__________ item in the list and compare it. If the number matches Linear,
then the _________ stops and the number is _________. If the number Inefficient,
is __________ it searches for the number in the lower end of the list, if Search,
the number is _________ it searches the higher end of the list. First,
________ searches are used on unordered lists. They start from the Binary,
________ item in the list and compare it. If the number is not a match Higher,
it moves to the next ________ in the list and compares again. This Position,
search might have to check every item in the list which makes it Lower
________ to use in many cases.
Bubble Sort
A bubble sort has 5 steps. List them below:

1.
2.
3.
4.
5.
Bubble Sort
Perform a bubble sort on the following string:

66 21 38 15 89 49

You will need to insert extra slides to show me each pass. I will need to
what happens at each stage of the pass AND how many passes in total
you will need to complete to ensure that the string is sorted.
Insertion Sort
An Insertion Sort has three steps. Identify them below:

1.
2.
3.
Insertion Sort
Eggs Bacon Mushrooms Tea Toast Sausages Beans

Complete an insertion sort on the above (Hint: Don’t forget your


alphabet)
Merge Sort
There are 4 steps to a Merge Sort. List them below:

1.
2.
3.
4.
Merge Sort
Perform a Merge Sort on the list below. Show me each stage as you go
through them:

KBTLRSF
Algorithms

1. Write this up as a Flowchart


2. Write this up as Pseudocode
3. Write this up in Python and print screen the code you used
Algorithms
A restaurant wants an algorithm which will split whatever the total of
the bill is by the number of diners.

1. The user needs to input the total bill


2. The user needs to input the number of diners
3. The algorithm needs to divide the total of the bill by the number of
diners and output a message saying what each diner needs to pay

1. Write this up as a Flowchart


2. Write this up as Pseudocode
3. Write this up in Python and print screen the code you used

You might also like