Essential algorithms and data structures

Source code in Python, Visual Basic and C#

This download provides you with fully working solutions to complement our textbook, “Essential algorithms and data structures”.

Algorithms include:

  1. A*
  2. Binary search
  3. Binary tree with an array
  4. Binary tree with objects
  5. Bubble sort
  6. Dictionary
  7. Dijkstra’s shortest path
  8. Graph – breadth first traversal
  9. Graph – depth first traversal (iterative)
  10. Graph – depth first search traversal (recursive)
  11. Hash table search
  12. Insertion sort
  13. Linear search
  14. Linked list with an array
  15. Linked list with objects
  16. Merge sort (iterative)
  17. Merge sort (recursive method 1)
  18. Merge sort (recursive method 2)
  19. Queue (circular) with an array
  20. Quicksort (Hoare method)
  21. Quicksort (Lomuto method)
  22. Quicksort (Variant method)
  23. Stack with an array
  24. Stack with objects


We have chosen to provide coded solutions in Python 3 because it is the most popular language taught at GCSE, in Visual Basic Console (2015 onwards) because it is a language that most closely resembles the pseudocode and coded examples students will need to work with in examinations, and C# as it is a leading industry standard language.

For those students studying other languages such as C++ / Java etc it would be a great exercise to translate the code presented in this book.

Readers should consider that there are many ways to code these algorithms. What is important is that students recognise the underlying data structures, understand the way an algorithm works, and can determine the output from a piece of code. Therefore, the approaches and solutions presented in this download are a solution, not THE solution.

Source code for Visual Basic and C# will need to be copied into an IDE such as Visual Studio.

What extra is in the 200 page book?

Each algorithm / data structure has its own dedicated chapter in the book, which includes:

  1. An overview of the algorithm or data structure
  2. Typical applications and uses
  3. Typical operations with each data structures
  4. The algorithm written in simple structured English
  5. The algorithm written in pseudocode
  6. Full code listing in Python
  7. Source code in Python, Visual Basic and C# are also available to download
  8. Walk-through of the algorithm
  9. Efficiency discussion with reference to Big-O notation