These guys

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

1/32

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.

33 Terms

1
New cards

Binary Heap (Min-Heap) Validity

It must be a complete binary tree and satisfy the heap property: parent ≤ children.

2
New cards

Adding to a Binary Heap

Insert at the next open spot, then bubble up to restore the heap property.

3
New cards

Deleting from a Binary Heap (Min-Priority)

Remove the root, replace with the last node, then bubble down to restore order.

4
New cards

Binary Search Tree (BST) Validity

It must follow the BST property: left < root < right.

5
New cards

Adding to a BST

Recursively find the correct spot and insert the value as a leaf.

6
New cards

Deleting from a BST (Min-Priority)

Remove node: Leaf → delete; 1 child → replace with child; 2 children → replace with in-order successor, then delete the successor.

7
New cards

AVL Tree Validity

It must be a BST and balanced, with a balance factor ∈ {–1, 0, 1}.

8
New cards

Adding to an AVL Tree

Insert like in a BST, then rebalance using rotations (LL, RR, LR, RL) if needed.

9
New cards

Deleting from an AVL Tree (Min-Priority)

Delete like in a BST, then rebalance up the path to the root using rotations.

10
New cards

Bubble Sort Method

It repeatedly swaps adjacent elements if they are in the wrong order.

11
New cards

Bubble Sort Time Complexity

Worst & Average: O(n²), Best: O(n).

12
New cards

Bubble Sort Memory Usage

O(1) (in-place).

13
New cards

Is Bubble Sort Stable?

Yes.

14
New cards

Insertion Sort Method

Builds the sorted list one item at a time by inserting into the correct position.

15
New cards

Insertion Sort Time Complexity

Worst & Average: O(n²), Best: O(n).

16
New cards

Insertion Sort Memory Usage

O(1) (in-place).

17
New cards

Is Insertion Sort Stable?

Yes.

18
New cards

Selection Sort Method

Repeatedly selects the smallest element and moves it to the sorted position.

19
New cards

Selection Sort Time Complexity

Worst/Average/Best: O(n²).

20
New cards

Selection Sort Memory Usage

O(1) (in-place).

21
New cards

Is Selection Sort Stable?

No.

22
New cards

Shell Sort Method

Improves insertion sort by comparing and sorting elements far apart (using a gap sequence).

23
New cards

Shell Sort Time Complexity

Worst: O(n²) or better depending on gap, Best: O(n log n).

24
New cards

Shell Sort Memory Usage

O(1) (in-place).

25
New cards

Is Shell Sort Stable?

No.

26
New cards

Quick Sort Method

Divides the array around a pivot and recursively sorts partitions.

27
New cards

Quick Sort Time Complexity

Worst: O(n²), Average/Best: O(n log n).

28
New cards

Quick Sort Memory Usage

O(log n) for recursion stack.

29
New cards

Is Quick Sort Stable?

No.

30
New cards

Merge Sort Method

Splits the array, recursively sorts halves, and merges them.

31
New cards

Merge Sort Time Complexity

All cases: O(n log n).

32
New cards

Merge Sort Memory Usage

O(n) for merging.

33
New cards

Is Merge Sort Stable?

Yes.