TREES + BST + HEAPS MASTER DECK

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

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.

31 Terms

1
New cards

Tree definition

Nonlinear hierarchical data structure

2
New cards

Root definition

Topmost node in a tree

3
New cards

Leaf definition

Node with no children

4
New cards

Internal node definition

Node with at least one child

5
New cards

Tree height definition

Longest root-to-leaf path

6
New cards

Full binary tree

Each node has 0 or 2 children

7
New cards

Complete binary tree

All levels filled left to right

8
New cards

Perfect binary tree

Every level is full

9
New cards

Preorder traversal

Root, left, right

10
New cards

Inorder traversal

Left, root, right

11
New cards

Postorder traversal

Left, right, root

12
New cards

Level order traversal

Uses a queue

13
New cards

BST property

Left child < root < right child

14
New cards

BST search average complexity

O(log n)

15
New cards

BST search worst-case

O(n)

16
New cards

BST insert complexity

O(log n) average, O(n) worst

17
New cards

BST inorder output

Sorted values

18
New cards

Why BST becomes skewed

Data inserted in sorted order

19
New cards

Heap property (min heap)

Parent node smaller than children

20
New cards

Heap completeness requirement

Always a complete binary tree

21
New cards

Heap storage format

Array

22
New cards

Heap insert complexity

O(log n)

23
New cards

Heap pop/remove-min complexity

O(log n)

24
New cards

Heap peek-min complexity

O(1)

25
New cards

Heap build from array complexity

O(n) (heapify)

26
New cards

Index formula left child

2*i + 1

27
New cards

Index formula right child

2*i + 2

28
New cards

Index formula parent

(i - 1) / 2

29
New cards

Difference BST vs Heap

BST ordered by in-order property, heap ordered by parent-child only

30
New cards

Difference heap vs priority queue

Priority queue is the ADT, heap is the implementation

31
New cards

Priority queue main operations

insert, getMin, removeMin