CS paper 2 Flashcards
1
Q
Key Features of Bubble sort
A
Uses an outer while loop (to test to see if no swaps where made in a pass)
Uses an inner for loop (repeated for the length of the code)
Uses a flag (boolean value) to track if a swap has been made
Uses a temporary value to help correctly swap elements
2
Q
Key features of merge sort
A
Calls itself within the subroutine (known as a recursive algorithm)
Splits the sublists continously left and right by 2 until each sublist has 1 value, then it’ll merge them
3
Q
Key features of binary search
A
Uses a while loop repeatedly (to compare the midpoint to the target value)
4
Q
A