Bubble Sort (OCR A-Level Computer Science): Flashcards
📚Flashcards
Practise the cards
12 cards from this deck
ShowHide
Practise the cards
12 cards from this deck
Bubble Sort definition
Bubble Sort definition
Repeatedly compares adjacent elements & swaps if wrong order
Pass in Bubble Sort
Pass in Bubble Sort
One complete iteration through the list
Stable property (Bubble Sort)
Stable property (Bubble Sort)
Maintains relative order of equal elements
In-Place property (Bubble Sort)
In-Place property (Bubble Sort)
Requires small, constant extra memory
Best case time complexity: Bubble Sort
Best case time complexity: Bubble Sort
Worst case time complexity: Bubble Sort
Worst case time complexity: Bubble Sort
Average case time complexity: Bubble Sort
Average case time complexity: Bubble Sort
Purpose of swapped flag
Purpose of swapped flag
Optimise & avoid unnecessary passes when list sorted
When Bubble Sort achieves
When Bubble Sort achieves
When list is already sorted
When Bubble Sort achieves worst case
When Bubble Sort achieves worst case
When list sorted in reverse order
Main operation in Bubble Sort
Main operation in Bubble Sort
Repeatedly swapping adjacent elements until sorted
Bubble Sort practicality for large data
Bubble Sort practicality for large data
Not practical - inefficient
