Fiveable
Fiveable

Selection Sort

Definition

Selection Sort is a simple sorting algorithm that repeatedly finds the minimum element from an unsorted portion of the list and swaps it with the first element of that portion until the entire list is sorted.

Analogy

Imagine you have a deck of cards and you want to sort them in ascending order. With selection sort, you would repeatedly find the smallest card from the remaining unsorted cards and swap it with the first card in that portion. This process continues until all cards are sorted.

Related terms

Insertion Sort: A sorting algorithm where elements are gradually inserted into their correct positions within a partially sorted array.

Bubble Sort: A simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.

Quick Sort: A divide-and-conquer sorting algorithm that selects a pivot element and partitions the array around it. It recursively sorts subarrays before and after the pivot.

collegeable - rocket pep

Are you a college student?

  • Study guides for the entire semester

  • 200k practice questions

  • Glossary of 50k key terms - memorize important vocab



© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.