Introduction to selection sort
Selection sort is another simple sorting algorithm that builds the final sorted list by dividing the input list into two sublists, one sorted and the other unsorted. At each iteration, it picks the smallest element from the unsorted list and moves it to the end of the sorted list. It is not the most efficient, but it is widely studied as a straightforward sort for beginners.
Is selection sort faster than bubble sort?
Selection sort almost consistently outperforms bubble sort in real-world applications as it uses a single swap instead of multiple swaps used by bubble sort to place an item in its sorted position.
Selection sort almost consistently outperforms bubble sort in real-world applications as it uses a single swap instead of multiple swaps used by bubble sort to place an item in its sorted position.
Example
Liking the course? Check our discounted plans to continue learning.