OCR A Level CS 2.3.3 Sorting Algorithms

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/13

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

14 Terms

1
New cards

What is the purpose of sorting algorithms?

To arrange a collection of elements into a specific order, usually ascending or descending.

2
New cards

What are the four main sorting algorithms in OCR A-Level?

âś… Bubble Sort
âś… Insertion Sort
âś… Merge Sort
âś… Quick Sort

3
New cards

How does bubble sort work?

Compares adjacent elements and swaps them if they are in the wrong order. This continues until the list is sorted.

4
New cards

What is the time complexity of bubble sort?

O(n²) (Quadratic) – very slow for large lists.

5
New cards

How can bubble sort be optimized?

By adding a noSwap flag to stop sorting early if no swaps occur in a pass.

6
New cards

How does insertion sort work?

Builds a sorted list by inserting each new element into its correct position in the sorted part.

7
New cards

What is the time complexity of insertion sort?

O(n²) – inefficient for large lists but fast for nearly sorted data.

8
New cards

How does insertion sort compare to bubble sort?

More efficient, as it only makes necessary swaps.

9
New cards

How does merge sort work?

Uses divide and conquer – splits the list into halves, recursively sorts them, then merges them back together.

10
New cards

What is the time complexity of merge sort?

O(n log n) – much faster than bubble and insertion sort.

11
New cards

What is the drawback of merge sort?

It requires extra memory for storing sublists.

12
New cards

How does quick sort work?

Chooses a pivot, then partitions elements into smaller or larger than the pivot, and recursively sorts both parts.

13
New cards

What is the time complexity of quick sort?

O(n²) in worst case, but O(n log n) on average

14
New cards

When is quick sort faster than merge sort?

When memory usage is a concern, as quick sort is in-place (doesn’t use extra memory).