DSA MIDTERMS

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

1/33

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.

34 Terms

1
New cards

Binary Tree

A hierarchical data structure where each node has at most two children (left and right).

2
New cards

Root

The topmost node in a binary tree.

3
New cards

Leaf Node

A node with no children (both left and right are NULL).

4
New cards

Node Fields

Data element, pointer to left child, pointer to right child.

5
New cards

Tree Traversal

The process of visiting every node in a tree exactly once in a particular order.

6
New cards

Breadth—First Traversal (BFT)

Also known as Level Order Traversal; visits nodes level by level using a queue.

7
New cards

Depth—First Traversal (DFT)

Explores as deeply as possible along one branch before backtracking.

8
New cards

Inorder Traversal

Visits left subtree, root, then right subtree (L → Root → R). In BST, this yields sorted order.

9
New cards

Preorder Traversal

Visits root, then left subtree, then right subtree (Root → L → R). Used in tree copying.

10
New cards

Postorder Traversal

Visits left subtree, then right subtree, then root (L → R → Root). Used in deleting trees.

11
New cards

Binary Search Tree (BST)

An ordered binary tree with rules: left child < parent < right child, no duplicates allowed.

12
New cards

BST Property

Both left and right subtrees must also be BSTs.

13
New cards

BST Unique Keys

Every node in a BST has a unique key; duplicates are not allowed.

14
New cards

BST Rule Left

Left subtree contains only nodes with keys less than the parent.

15
New cards

BST Rule Right

Right subtree contains only nodes with keys greater than the parent.

16
New cards

AVL Tree

A self—balancing Binary Search Tree.

17
New cards

AVL Balanced

BF must be —1, 0, or +1.

18
New cards

AVL Unbalanced

If BF < —1 or BF > +1, the tree needs rotations.

19
New cards

LL Rotation

Right rotation used when the tree is left—left heavy.

20
New cards

RR Rotation

Left rotation used when the tree is right—right heavy.

21
New cards

LR Rotation

Left rotation on child, then right rotation on parent (zig—zag case).

22
New cards

RL Rotation

Right rotation on child, then left rotation on parent (zig—zag case).

23
New cards

Heap

A complete binary tree that satisfies the heap order property.

24
New cards

Heap Shape Property

A heap is always a complete binary tree (all levels filled, last filled left to right).

25
New cards

Heap Order Property

Parent is always ≥ children (max—heap) or ≤ children (min—heap).

26
New cards

Max—Heap

Parent ≥ children, largest value always at the root.

27
New cards

Min—Heap

Parent ≤ children, smallest value always at the root.

28
New cards

Heap Operations

Insert, Extract Root, Peek, Replace.

29
New cards

Heapify

Process of restoring heap property after insertion or deletion.

30
New cards

Up—Heapify (Bubble Up)

Used after insertion to restore heap property by moving the element up.

31
New cards

Down—Heapify (Bubble Down)

Used after deletion of root to restore heap property by moving the root down.

32
New cards
33
New cards

Priority Queue

Abstract data type where elements are dequeued based on priority, not arrival order.

34
New cards

Priority Queue with Heap

Implemented using a heap for fast insertion and extraction.