Compatibility: Although written in Python 2.7, these Python files should be fully compatible with Python 3.
This is an example of the code that can be found inside of the AS Algorithms code example resource. If you found this code useful then please consider the full version that contains code examples for the following algorithms:
- Sequential/Linear Search
- Binary Search
- Hash Tables
- Insertion Sort
- Merge Sort
- Bubble Sort
- Quick Sort
Inside the merge sort example there are five different pieces of example code:
- Merge Sort – This file is a basic merge sort, showing a list before and after it is sorted. The code contains no comments and is designed to allow students chance to try and work out what the code is doing.
- Merge Sort with comments – This file extends on the basic merge sort program by adding detailed comments on what is happening.
- Merge sort with output – This file extends the merge sort by including detailed output in the console to show what is happening at each individual stage of the algorithm.
- Merge sort with comparisons – This file counts the number of comparisons that are made whilst the algorithm is running to allow students to estimate the order (Big O) of the algorithm
- Merge sort incomplete – This is a skeleton code file that has sections of the code missing, allowing students to try and devise their own logical solution to the merge sort problem.
If you wish to learn more about the complete AS Algorithms code example resource then visit the resource page here.