CMSC 401 Exam 2

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/6

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:17 PM on 3/30/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

7 Terms

1
New cards

Heap

A complete binary tree that:

  • Max: every parent node is greater than or equal to its children

  • Min: every parent node is less than or equal to its children
    Heaps are commonly used to implement priority queues.

2
New cards

Binary Search Tree

A binary tree data structure where for every node:

  • All values in the left subtree are smaller than the node

  • All values in the right subtree are larger than the node
    This property allows efficient searching, insertion, and deletion (typically O(log n) when balanced).

3
New cards

What is the main difference between a Binary Search Tree (BST) and a Heap?

The first maintains a global ordering property (left subtree < node < right subtree), which allows efficient searching for any element.

The second only maintains a parent-child ordering property (max or min at the root), which allows fast access to the largest or smallest element but does not support efficient searching for arbitrary elements.

4
New cards

Depth-First Search

A graph or tree traversal algorithm that explores as far down a branch as possible before backtracking. It typically uses a stack or recursion.

5
New cards

Breadth-First Search

A graph or tree traversal algorithm that explores nodes level by level, visiting all neighbors of a node before moving to the next level.
It typically uses a queue data structure.

6
New cards

How does Dijkstra’s Algorithm work?

  1. Assigning distance 0 to the starting node and ∞ to all other nodes.

  2. Repeatedly selecting the unvisited node with the smallest distance.

  3. Updating the distances to its neighbors if a shorter path is found.

  4. Marking the node as visited and repeating until all nodes are processed. graph algorithm used to find the shortest path from a starting node to all other nodes in a weighted graph, as long as all edge weights are non-negative.

using a priority queue (min-heap) to efficiently select the node with the smallest current distance.

7
New cards

Dijkstra’s Shortest Path Algorithm

A graph algorithm used to find the shortest path from a starting node to all other nodes in a weighted graph, as long as all edge weights are non-negative.

Explore top flashcards

flashcards
Cô Yến 5/12/2024
22
Updated 480d ago
0.0(0)
flashcards
EXAM 2 - part 6
22
Updated 250d ago
0.0(0)
flashcards
Einheit 1 Freunde
75
Updated 229d ago
0.0(0)
flashcards
Biology Honors Evolution
51
Updated 1096d ago
0.0(0)
flashcards
Matiekos egzas
73
Updated 819d ago
0.0(0)
flashcards
Livy 2.10 Vocab
20
Updated 1215d ago
0.0(0)
flashcards
Cô Yến 5/12/2024
22
Updated 480d ago
0.0(0)
flashcards
EXAM 2 - part 6
22
Updated 250d ago
0.0(0)
flashcards
Einheit 1 Freunde
75
Updated 229d ago
0.0(0)
flashcards
Biology Honors Evolution
51
Updated 1096d ago
0.0(0)
flashcards
Matiekos egzas
73
Updated 819d ago
0.0(0)
flashcards
Livy 2.10 Vocab
20
Updated 1215d ago
0.0(0)