Photo AI
Last Updated Sep 26, 2025
Revision notes with simplified explanations to understand Algorithms quickly and effectively.
313+ students studying
An algorithm is a process or set of rules that is used to solve a problem. E.g., cake recipe, long division method, back-end of a search engine such as Google.
The two main factors that determine the efficiency of an algorithm are time and space:
Pseudo code is a description outlining the steps of an algorithm in plain language. It is often used to plan out how an algorithm will function and is intended for human reading, not machine reading.
The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from the unsorted part and putting it at the beginning.
First Pass: 64 25 12 22 11 (11 is identified as the lowest number and placed at index 0) 11 25 12 22 64
Second Pass: 11 25 12 22 64 (25 is selected, 12 is the new lowest number, they are swapped) 11 12 25 22 64 This continues until the array is fully sorted.
Insert sort is a simple sorting algorithm that works similar to the way you sort playing cards in your hands. The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed at the correct position in the sorted part.
First Pass: 12 11 13 5 6 (The first two elements are compared and sorted) 11 12 13 5 6
Second Pass: 11 12 13 5 6 (These numbers are correct, so no change is made) 11 12 13 5 6
This continues until the whole array is sorted.
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order. This algorithm is not suitable for large data sets as its average and worst-case time complexity is quite high.
First Pass: 5 1 4 2 8 (Compares first two and swaps them)
Second Pass: 1 4 2 5 8 (No swap)
Algorithm makes one more pass to confirm array is sorted.
Merge sort is a sorting algorithm that works by dividing an array into smaller subarrays, sorting each subarray, and then merging the sorted subarrays back together to form the final sorted array.
Like Merge Sort, Quick Sort is a Divide and Conquer algorithm. It picks an element as a pivot and partitions the given array around the picked pivot. There are many different versions of Quick sort that pick pivot in different ways.
Linear Search is defined as a sequential search algorithm that starts at one end and goes through each element of a list until the desired element is found, otherwise the search continues till the end of the data set. It is the easiest searching algorithm.
The basic steps to perform Binary Search are:
It is important to understand the time and efficiency so that different algorithms can be compared, particularly as data sets grow. It allows for the best algorithm to be selected for the specific problem. The best algorithm should be the fastest and/or use least amount of memory.
Big O notation describes how the complexity of an algorithm grows relative to the size of the input (in most cases, the input will be a list).
Algorithm | Worst Case Time Complexity | Best Case Time Complexity |
---|---|---|
Selection Sort | O(n²) | O(n²) |
Insert Sort | O(n log n) | O(n) |
Bubble Sort | O(n²) | O(n) |
Merge Sort | O(n log n) | O(n log n) |
Quick Sort | O(n²) | O(n log n) |
Enhance your understanding with flashcards, quizzes, and exams—designed to help you grasp key concepts, reinforce learning, and master any topic with confidence!
90 flashcards
Flashcards on Algorithms
Revise key concepts with interactive flashcards.
Try Computing Science Flashcards2 quizzes
Quizzes on Algorithms
Test your knowledge with fun and engaging quizzes.
Try Computing Science Quizzes29 questions
Exam questions on Algorithms
Boost your confidence with real exam questions.
Try Computing Science Questions27 exams created
Exam Builder on Algorithms
Create custom exams across topics for better practice!
Try Computing Science exam builder4 papers
Past Papers on Algorithms
Practice past papers to reinforce exam experience.
Try Computing Science Past PapersDiscover More Revision Notes Related to Algorithms to Deepen Your Understanding and Improve Your Mastery
Load more notesJoin 500,000+ Scottish Highers students using SimpleStudy...
Join Thousands of Scottish Highers Students Using SimpleStudy to Learn Smarter, Stay Organized, and Boost Their Grades with Confidence!
Report Improved Results
Recommend to friends
Students Supported
Questions answered