From the course: Foundations of Algorithmic Thinking with Python
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Selection Sort introduction - Python Tutorial
From the course: Foundations of Algorithmic Thinking with Python
Selection Sort introduction
- [Instructor] Selection sort is a simple and intuitive sorting algorithm. It can be performed using an auxiliary array to store the results or done in place, meaning the original array is modified and no additional storage is required. Since the in place version is not difficult to implement, and saves on storage requirements, this is the version you will usually see. The basic idea of selection sort is you find the smallest element in the array and you exchange it with the element in the first position. Then you repeat this process for the remaining items. So you next find the second smallest element in the array and you exchange it with the element in the second position. And you keep on doing this until the array is sorted. Let's look an animation of this algorithm now. So you can find this animation on visualgo.net, and you can add your own items to sort. I've created a list using a very short list so we can see the…