Save
Computer science OCR A Level
2.3.3 Sorting Algorithms
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Aanya Sinha
Visit profile
Cards (27)
What is the purpose of sorting algorithms?
To arrange
elements
in
logical order
View source
What types of order do sorting algorithms typically output?
Numerical
or
lexicographic
order
View source
How can sorting algorithms be modified to output in descending order?
By switching an
inequality
or
reversing
output
View source
What is the basic operation of bubble sort?
Comparisons
and
swaps
between pairs
View source
What happens to the largest element during bubble sort?
It "bubbles" to the top of the data
View source
What does one pass of bubble sort accomplish?
Places the
largest
element in the last position
View source
How many passes does bubble sort perform for an array with n elements?
n passes
View source
What is the pseudocode structure for bubble sort?
Two nested loops comparing adjacent elements
View source
What is the purpose of the temporary store in bubble sort?
To facilitate the
swap operation
View source
What indicates the end of the first pass in bubble sort?
The
largest
element
is
in
the
last
position
View source
What modification improves the bubble sort algorithm?
Introducing a
flag
to track swaps
View source
What does the noSwap flag indicate in the improved bubble sort?
No swaps
occurred
during a full pass
View source
What is the time complexity of bubble sort?
O(n<sup>2</sup>)
View source
How does insertion sort differ from bubble sort?
It places elements into a
sorted sequence
View source
What does the ith iteration of insertion sort accomplish?
Sorts
the
first i elements
of the
array
View source
How does insertion sort insert an element into the sorted sequence?
By moving
larger elements
to the right
View source
What is the time complexity of insertion sort?
O(n<sup>2</sup>)
View source
What is the main concept behind merge sort?
Divide and conquer
strategy
View source
What are the two functions involved in merge sort?
MergeSort
and
Merge
View source
What does MergeSort do with its input?
Divides it into two parts
recursively
View source
What is the worst-case time complexity of merge sort?
O(n log n)
View source
How does the merging process work in merge sort?
Compares
and combines elements from lists
View source
What is the role of the pivot in quick sort?
To
divide
the
input
around it
View source
What is the time complexity of quick sort?
O(n<sup>2</sup>)
View source
How does quick sort determine the position of the pivot?
By selecting the
central
element
View source
What happens to old pivots in quick sort?
They remain in their
correct position
View source
What is the stopping condition for quick sort?
All elements are
old pivots
or
length 1
View source