B2.4 Programming algorithms - IB Diploma Class 11 Computer Science Notes, Diagrams and Solved Questions
How to judge and write classic algorithms in Python and Java: Big O for time and space, linear and binary search, bubble and selection sort, and choosing between them, with recursion and quicksort as the HL extension.
In this chapter
Big O notation for time and space complexity
O(1), O(log n), O(n), O(n log n), O(n²) and O(2ⁿ) with examples
Linear search and its best and worst cases
Binary search on sorted data, traced step by step
Bubble sort with an early stop, and selection sort
Comparing algorithms by growth, data size and whether data is sorted
Iteration 3 (HL): recursion, quicksort and analysing recursive algorithms