16.1 Intro to Sorting

Intro to Sorting

Sorting - The definition of sorting is arranging a sequence of elements by some category. Sorting is everywhere in everyone’s day-to-day life. For instance, a dictionary (like the one you can buy) sorts words alphabetically. Why is this useful? Well, it is easier and quicker to find words. In Python, sorting a structure (like a list of numbers) also makes it easier and quicker to find elements.

"Why do we learn sorting and selection sort?"

The reason is not to actually use it in our code. Python and many other languages already have a built-in sorting method that is fast.

The real reason behind learning sorting is because sorting serves as a good introduction to algorithms (Selection Sort is also one of the easier sorting algorithms). After learning algorithms, your problem-solving skills will be greatly improved, you will be able to translate words into code, and you will be able to tell how good your code is.


Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.