Searching and Sorting Algorithms (OCR A-Level Computer Science): Flashcards

📚Flashcards
Searching and Sorting Algorithms
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

15 cards from this deck

Show

Purpose of searching algorithms

Locate specific data within a collection

Purpose of sorting algorithms

Arrange data in specific order (ascending/descending)

Linear Search pre-condition

None - works on sorted & unsorted data

Binary Search pre-condition

Data must be sorted in ascending or descending order

Linear Search time complexity

O(n)O(n)

Binary Search time complexity

O(logn)O(\log n)

How Linear Search works

Searches each element sequentially

How Binary Search works

Repeatedly divides search interval in half

How Bubble Sort works

Repeatedly swaps adjacent elements if in wrong order

Bubble Sort worst case complexity

O(n2)O(n^2)

How Insertion Sort works

Builds sorted list one item at a time

Merge Sort complexity (all cases)

O(nlogn)O(n \log n)

How Merge Sort works

Divides array into halves, sorts each, then merges

Quick Sort worst case complexity

O(n2)O(n^2) - due to poor pivot selection

How Quick Sort works

Partitions array around pivot, recursively sorts partitions

Explore OCR A-Level Computer Science Revision Notes by Topics

Explore OCR A-Level Computer Science Model Answers by Topics

Explore OCR A-Level Computer Science Quizzes by Topics

Explore OCR A-Level Computer Science Exam Questions by Topics

Join 100,000+ A-Level students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.