Font size
WorksheetsOCR GCSE CS - 2.1 ERL sorts and searches
Total questions: 9
Worksheet time: 5mins
while searchIndex < _______(searchList)
What is the missing command to check how big the list is?
input
len
div
How does a bubble sort ensure no data is lost when swapping values?
Adds it to a list
Converts it to an integer
Uses a temporary variable
Stores it in a tuple
What algorithm does this represent?
searchIndex = 0
while searchIndex < len(searchList)
if searchList[searchIndex] == searchItem then
return true
endif
searchIndex = searchIndex + 1
endwhile
return false
Binary search
Linear search
Bubble sort
Insertion sort
Which search or sort finds the midpoint, checks if what they are looking for is higher or lower and discards the half not needed?
(a)
midPoint = (start + end) DIV 2
Which search or sort would this line of code belong to?
Binary search
Linear Search
Merge sort
Insertions sort
temp = sortList [sortCount]
sortList[sortCount] = sortList[sortCount + 1]
sortList[sortCount + 1] = temp
Which search or sort would this line of code belong to?
Binary search
Linear Search
Merge sort
Insertions sort
Bubble sort
temp = sortList [sortCount]
sortList[sortCount] = sortList[sortCount + 1]
sortList[sortCount + 1] = temp
Which does the above code do?
Puts the value into a temporary variable
Deletes the variable
Goes to the next value in the list
Creates a new list
Which line of code checks to see if an element in sortList is greater than the one to the left of it. It then repeats this working backwards through the list, until the element is in the correct place.
return sortList
for sortCount = 1 to len(sortList) - 1
temp = sortList [listIndex]
while listIndex > 0 and sortList[listIndex] < sortList[listIndex-1]
Which algorithm splits the arrays into sub-arrays of 1 element.
Binary search
Linear Search
Merge sort
Insertions sort
Bubble sort
