Sorting is perhaps the most ubiquitous problem in the field of algorithms. There are three main reasons for this:

  1. The problem is easy to understand and not abstract.
  2. The problem is complicated enough to have several interesting solutions.
  3. Sorting is used very often in programs and algorithms in some way or another.

Python has some built-in functions for sorting, of course, but in this mission of our Algorithm Complexity course we're going to dig into implementing our own sorting functions so that we have more control over what's happening.

As with previous missions in this course, and all Dataquest courses, you'll be applying what you're learning in real time thanks to our interactive code editor. 

Objectives

  • Learn how to implement your own sorting algorithm
  • Learn the time complexity of sorting in Python

Mission Outline

1. Sorting in Python
2. Swapping
3. Selecting the Minimum
4. Selection Sort
5. Complexity of Selection Sort
6. Sum of The First N Naturals
7. Find Equal Pairs of Indexes
8. Comparing Insertion Sort with Python Sort
9. Next Steps
10. Takeaways