Preview lessons, content and tests

Computer Science & Programming solved. All in one platform.

1. To trial the platform and take tests, please take a few seconds to SIGN UP and SET UP FREE.
2. Searching for something specific? See our text overview of all tests. Includes 'real teacher' use videos.

Join 30000+ teachers and students using TTIO.

Sorting Algorithms Overview

In computer science, a sorting algorithm is exactly what you'd imagine it would be - it's simply an algorithm that puts elements of a list in a certain order. Sounds simple enough doesn't it, but if you really think about it, so much of what we do - particularly with data - involves sorting, and without it, well, we'd be stuck! Sorting a small list of say 10 names in alphabetical order is rather simple, but consider a list that is comprised of a million items - what then? Obviously, the more efficient the sorting algorithm, the better, particularly in terms of time efficiency. A ton of people have even dedicated their entire lives to this stuff ....so don't put it aside as boring just yet!

The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human-readable output. More formally, the output must satisfy two conditions: The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order); The output is a permutation (reordering but with all of the original elements) of the input. Further, the data is often taken to be in an array, which allows random access, rather than a list, which only allows sequential access, though often algorithms can be applied with suitable modification to either type of data.

This series will primarily look at python code for the various sorting algorithms, along with an explanation (video or presentation) for each. If you're really interested however, there is plenty of additional information on this topic below:

Basic :

  1. Sorting Terminology
  2. Stability in sorting algorithms
  3. Time complexities of Standard Sorting Algorithms
  4. External Sorting

Sorting Algorithms :

www.teachyourselfpython.com