PrepGo

AP Computer Science A Flashcards: Sorting Algorithms

Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026

Review key ideas with interactive flashcards. This set includes 10 cards to help you master important concepts.

How is the 'sorted portion' of a list built using Insertion Sort?
The sorted portion grows from the beginning of the list by taking the next available unsorted element and inserting it into the correct spot within that sorted part.
Card 1 of 10

All Flashcards (10)

How is the 'sorted portion' of a list built using Insertion Sort?
The sorted portion grows from the beginning of the list by taking the next available unsorted element and inserting it into the correct spot within that sorted part.
What is the key difference in how elements are placed in Selection Sort vs. Insertion Sort?
In Selection Sort, an element is swapped into its correct and final position, while in Insertion Sort, an element is placed in its correct, but not necessarily final, position.
In Insertion Sort, what happens to elements in the sorted portion when a new element is added?
Elements in the sorted portion that are greater than the new element are shifted one position to the right to create space for the insertion.
What is the core action performed during each pass of Selection Sort?
The algorithm finds the smallest element in the remaining unsorted portion of the list and swaps it with the element at the beginning of the unsorted portion.
What is Selection Sort?
Selection sort is an iterative algorithm that repeatedly selects the smallest element from the unsorted portion of a list and swaps it into its final position in the sorted portion.
What type of algorithms are Selection Sort and Insertion Sort?
Selection sort and insertion sort are both iterative sorting algorithms.
What is the core action performed during each pass of Insertion Sort?
The algorithm takes the next unsorted element and shifts elements in the sorted portion to the right until it finds the correct position to insert the new element.
After the first pass of Selection Sort on an unsorted array (sorting smallest to largest), what is true about the element at index 0?
The element at index 0 is the smallest element in the entire array and is now in its final, sorted position.
How is the 'sorted portion' of a list built using Selection Sort?
The sorted portion grows from the beginning of the list, with one element being added per pass after it is selected as the minimum and swapped into its final place.
What is Insertion Sort?
Insertion sort is an iterative algorithm that inserts an element from the unsorted portion into its correct position in the sorted portion by shifting other elements to make room.