Chapter 3 – Simple Sorting (Bubble, Selection, Insertion)

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/24

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards summarizing key terms and concepts from the lecture on bubble, selection and insertion sorting algorithms.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

25 Terms

1
New cards

Simple Sorting

Group of basic algorithms—bubble, selection and insertion—that are easy to implement but run in O(N²) time.

2
New cards

Bubble Sort

Algorithm that repeatedly compares adjacent elements and swaps them so the largest values ‘bubble’ to the end of the array.

3
New cards

Selection Sort

Algorithm that repeatedly selects the smallest (or largest) remaining item and swaps it into the next unsorted position, keeping swap count low.

4
New cards

Insertion Sort

Algorithm that builds a sorted section by removing the next item and inserting it into its correct place within the partially-sorted left side.

5
New cards

Pass (in sorting)

One complete traversal of the data by the inner loop during which comparisons and swaps/copies occur.

6
New cards

Swap

Operation that exchanges the values of two array elements, usually with the help of a temporary variable.

7
New cards

Comparison (Sorting)

Operation that evaluates two key values to decide ordering; core step of every sorting algorithm.

8
New cards

Inner Loop

The nested loop that performs element-level comparisons and operations during each pass of a sorting algorithm.

9
New cards

Outer Loop

The controlling loop that determines how many passes or positions must be processed in a sort.

10
New cards

Invariant

Condition that remains true throughout an algorithm (e.g., ‘items right of out are sorted’ in bubble sort).

11
New cards

Partially Sorted

State in insertion sort where items to the left of the divider are internally ordered but may shift as new items are inserted.

12
New cards

Key Field

Attribute used for ordering records during a sort, such as lastName in a Person object.

13
New cards

Stable Sort

Sort that preserves the original relative order of items with identical keys.

14
New cards

O(N²) Time Complexity

Performance where operations grow proportionally to the square of the data size; typical for simple sorts with nested loops.

15
New cards

In-Place Sort

Sorting method that rearranges elements within the original array, requiring only a constant amount of extra memory.

16
New cards

Shift (Insertion Sort)

Process of moving elements one position right to create space for the item being inserted.

17
New cards

Copy (Sorting)

Duplicating a value from one index to another; used during shifts in insertion sort and counted separately from swaps.

18
New cards

Binary Search

Fast O(log N) search requiring pre-sorted data; motivates the need for sorting arrays.

19
New cards

compareTo()

Java String method that returns a negative, zero or positive integer to indicate lexicographical ordering between two strings.

20
New cards

Lexicographical Comparison

Alphabetical ordering based on character sequence, used when comparing string keys.

21
New cards

Primitive Type

Built-in Java data type (e.g., long) used in simple sort examples for clarity.

22
New cards

Object Sorting

Applying sort algorithms to arrays of objects by comparing their key fields instead of primitive values.

23
New cards

Bubble Up

Informal term describing how the largest items move toward the end of the array during bubble sort passes.

24
New cards

Minimum Pointer (min)

Variable in selection sort that tracks the index of the smallest item found during the current pass.

25
New cards

Quicksort (Preview)

Faster O(N log N) algorithm covered later; often finishes with insertion sort on small or nearly-sorted subarrays.