Sorting Quiz

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/53

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

54 Terms

1
New cards

Selection Sort After k Iterations

smallest element from right subarray swapped into the front for k passes

2
New cards
3
New cards

Insertion Sort Idea

build sorted subarray on left, insert next element by comparing backward and swapping until correct spot

4
New cards
5
New cards

Bubble Sort Idea

repeatedly compare adjacent elements, swap if the left one is greater, "largest bubbles right" each pass

6
New cards
7
New cards

Merge Sort Idea

recursively split array into halves and merge them using temporary arrays

8
New cards
9
New cards

Heap Sort Idea

build a max heap, repeatedly swap root with last active element, shrink heap, then heapify root

10
New cards
11
New cards

Binary Search Tree (BST) Rule

left child < parent < right child

12
New cards
13
New cards

Inorder Traversal

Left → Root → Right, outputs BST values in increasing sorted order

14
New cards
15
New cards

Preorder Traversal

Root → Left → Right, shows insertion structure but not sorted

16
New cards
17
New cards

Postorder Traversal

Left → Right → Root, used for deletes/freeing but not sorted

18
New cards
19
New cards

Max Heap Rule

parent ≥ all children, largest element at root

20
New cards
21
New cards

Min Heap Rule

parent ≤ all children, smallest element at root

22
New cards
23
New cards

Heap Children Indexes

left = 2i+1, right = 2i+2

24
New cards
25
New cards

First Non-Leaf Index in Heap

floor(n/2) - 1

26
New cards
27
New cards

Stable Sort Definition

preserves the original relative order of equal-value elements

28
New cards
29
New cards

Unstable Sorts

Selection Sort, HeapSort, BST Sort

30
New cards
31
New cards

Stable Sorts

Insertion Sort, Bubble Sort, Merge Sort

32
New cards
33
New cards

In-Place Algorithm

modifies the input array directly using only a few extra variables

34
New cards
35
New cards

Out-Of-Place Definition

uses separate memory structure (extra array, tree, etc.) to output result

36
New cards
37
New cards

Merge Step Order Behavior

when equal, left half is chosen first (<=), ensuring stability

38
New cards
39
New cards

Selection Sort Swap Behavior

swaps smallest element found in scan into index i if smallest ≠ i

40
New cards
41
New cards

Worst Case Complexity (general comparison sorts)

O(n²) for simple nested-loop sorts, O(n log n) for divide/heap sorts, O(n²) for unbalanced BST chain

42
New cards
43
New cards

Time Complexity Definition

how runtime operations grow as input size n increases

44
New cards
45
New cards

Space Complexity Definition

how extra memory usage grows as input size n increases

46
New cards
47
New cards

Selection Sort Extra Space

O(1)

48
New cards
49
New cards

Merge Sort Extra Space

O(n)

50
New cards
51
New cards

Heap Sort Extraction Step

swap root with last active index, decrement heap size, heapify root to restore max-heap property

52
New cards
53
New cards

BST Sort Worst Case

O(n²) when inserted values are already sorted and tree becomes a chain

54
New cards

Explore top flashcards

Medical terma quiz 4
Updated 409d ago
flashcards Flashcards (44)
Skull
Updated 5h ago
flashcards Flashcards (47)
Integrals
Updated 665d ago
flashcards Flashcards (41)
Ch13-14 Civics
Updated 1034d ago
flashcards Flashcards (45)
List 35
Updated 1098d ago
flashcards Flashcards (35)
Medical terma quiz 4
Updated 409d ago
flashcards Flashcards (44)
Skull
Updated 5h ago
flashcards Flashcards (47)
Integrals
Updated 665d ago
flashcards Flashcards (41)
Ch13-14 Civics
Updated 1034d ago
flashcards Flashcards (45)
List 35
Updated 1098d ago
flashcards Flashcards (35)