Save
A-level Computer Science
School Notes
Search and Sort Algorithms
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Ana Saker
Visit profile
Cards (66)
What is a linear search?
A
sequential
search
through
a
list
View source
How does a linear search operate?
It
checks
each
item
sequentially
View source
What happens if the required item is not found in a linear search?
An
error
is returned
View source
When is a linear search appropriate to use?
When data is not
ordered
View source
What is the efficiency of a linear search?
Not very
efficient
View source
What is the best case scenario for a linear search?
Finding the
item first
View source
What is the average number of search steps for 100 items in a linear search?
50.5
search steps
View source
What are the steps of a linear search algorithm?
Compare the
search item
with the
first value
Compare with the
next value
Repeat until the
end
or item found
Return the
position
or -1 if
not found
View source
What is the average case time complexity of a linear search in Big O Notation?
O(n)
View source
What is the space complexity of a linear search?
O(1)
View source
What is the first step in a linear search algorithm?
If the list is
empty
, stop
View source
What does the Python code for a linear search return if the item is found?
The
index
of the item
View source
What is a binary search?
A faster search for
sorted
lists
View source
What strategy does a binary search use?
Divide and conquer
View source
What is the first step in a binary search?
Select the
median
item
View source
What happens if the search item is higher than the median in a binary search?
Discard
the median and lower items
View source
What is the average number of search steps for a binary search with 100 items?
Around
6
search steps
View source
What is the time complexity of a binary search in Big O Notation?
O(log(n))
View source
What is the space complexity of a binary search?
O(1)
View source
What does the Python code for a binary search return if the item is found?
The
index
of the item
View source
What is a bubble sort?
A method of
sorting
data
View source
How does a bubble sort operate?
It swaps
adjacent
items if
out of order
View source
When does a bubble sort complete?
When a full
pass
has no
swaps
View source
What is the efficiency of a bubble sort?
Not very
fast
View source
What is the average case time complexity of a bubble sort in Big O Notation?
O(n^2)
View source
What is the space complexity of a bubble sort?
O(1)
View source
What are the steps of a bubble sort algorithm?
Compare adjacent items
Swap if out of order
Repeat until no swaps occur
View source
What is a merge sort?
A sorting algorithm that splits lists
View source
How does a merge sort operate?
It
splits
lists and merges them
sorted
View source
What is the first step in a merge sort?
Split the
data list
into two lists
View source
What happens to sublists in a merge sort?
They are
recursively
split
until one
item
View source
What is the average case time complexity of a merge sort in Big O Notation?
O(n log(n))
View source
What is the space complexity of a merge sort?
O(n)
View source
What does the Python code for a merge sort return?
A
sorted list
View source
What are the steps of a merge sort algorithm?
Split the list into two halves
Recursively
split until one item
Compare first elements of
sublists
Select smaller item to merge
Repeat until all sublists are merged
View source
What is the first step in the Merge Sort process?
The
data list
is split into two lists
View source
How does the Merge Sort continue splitting the lists?
It
recursively
splits until each
sublist
is one item
View source
What happens after the sublists are split in Merge Sort?
The first
elements
of sublists are
compared
View source
What is done with the smaller item in Merge Sort?
It is
selected
and written to a
new list
View source
When does the Merge Sort process stop?
When all sorted
sublists
are recombined
View source
See all 66 cards