exam 2

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/11

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

12 Terms

1
New cards
<p></p>

Binary Search

2
New cards
term image

Bubble sort

3
New cards
<p></p>

Selection Sort

4
New cards
term image

Insertion Sort

5
New cards
term image

Merge Sort

6
New cards
term image

Quick Sort

7
New cards

Binary search

Range style: cuts the lists inhalf unitl elemtn is mid

Invariant: all candidates are in L[left: right)

Time: O(log n)

Space: O(log n) recursion

Needs: sorted array

Returns: True/False (contains check)

8
New cards

Bubble sort

  • Basic: scan left→right swapping out-of-order neighbors; largest “bubbles” to the end each pass.

  • Best Θ(n) (already sorted w/ early exit) • Avg/Worst Θ(n²) • Space O(1)

  • Stable: Yes • In-place: Yes • Adaptive: Yes (with early exit)

9
New cards

selection sort

  • Basic: repeatedly pick the min/max from the unsorted part and place it at the boundary.

  • Best/Avg/Worst Θ(n²) • Space O(1)

  • Stable: No • In-place: Yes • Adaptive: No

10
New cards

insertion sort

  • Basic: insert each item into the correct spot of the already-sorted left side.

  • Best Θ(n) (nearly sorted) • Avg/Worst Θ(n²) • Space O(1)

  • Stable: Yes • In-place: Yes • Adaptive: Yes

11
New cards

merge sort

  • Basic: split into halves, sort each, then merge two sorted lists.

  • Best/Avg/Worst Θ(n log n) • Space O(n)

  • Stable: Yes • In-place: No • Adaptive: No

12
New cards

quick sort

  • Basic: choose pivot, partition into < and > pivot, recurse on parts.

  • Best/Avg Θ(n log n) • Worst Θ(n²) (bad pivots like sorted data) • Space O(log n) stack

  • Stable: No • In-place: Yes • Adaptive: No