Knaph

Sorting

Putting items in order - how a simple method like selection sort works and why it is slow, and how to use Python's fast, stable sort with keys, including sorting by several things at once.

Depth 1 · Foundation

You can carry out selection sort pass by pass and say why it is O(n²), use sorted and list.sort with key and reverse, explain what a stable sort keeps, and sort by two keys with a tuple key or two sorts.

Sign in to prove what you know with a short quiz, see how deep you've gone, and earn XP for it.

Sign in with Google

Depths of understanding

  1. 1

    Foundation

    You can carry out selection sort pass by pass and say why it is O(n²), use sorted and list.sort with key and reverse, explain what a stable sort keeps, and sort by two keys with a tuple key or two sorts.

Your path here

What's still between you and Sorting, depth 1, in the order you can learn it.

  1. 1ProgramDepth 1 · Foundation · Program Basics
  2. 2ExpressionDepth 1 · Foundation · Program Basics
  3. 3Variables in codeDepth 1 · Foundation · Program Basics
  4. 4Program stateDepth 1 · Foundation · Program Basics
  5. 5Input and outputDepth 1 · Foundation · Program Basics
  6. 6Functions in codeDepth 1 · Foundation · Functions
  7. 7Return valuesDepth 1 · Foundation · Functions
  8. 8BooleansDepth 1 · Foundation · Control Flow
  9. 9ConditionalsDepth 1 · Foundation · Control Flow
  10. 10LoopsDepth 1 · Foundation · Control Flow
  11. 11AlgorithmDepth 1 · Foundation · Algorithms
  12. 12Accumulator patternDepth 1 · Foundation · Control Flow
  13. 13Floating-point numbersDepth 1 · Foundation · Data Types
  14. 14Basic typesDepth 1 · Foundation · Data Types
  15. 15Character encodingDepth 1 · Foundation · Data Types
  16. 16StringsDepth 1 · Foundation · Data Types
  17. 17ListsDepth 1 · Foundation · Data Structures
  18. 18DictionariesDepth 1 · Foundation · Data Structures
  19. 19Sets in codeDepth 1 · Foundation · Data Structures
  20. 20Algorithm efficiencyDepth 1 · Foundation · Algorithms
  21. 21First-class functionsDepth 1 · Foundation · Functions
  22. 22SortingDepth 1 · Foundation · Algorithms

Where it fits