A200 Exam 1

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
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

What is a data structure?

A way to store and organize data in a computer so that it can be used efficiently.

2
New cards

What is data abstraction?

It separates the logical view of the data from the physical view of how it is actually stored.

3
New cards

How is a procedure or an algorithm like a recipe?

It describes the exact steps needed to solve a problem or reach a goal.

4
New cards

What is an abstract data type?

A high-level definition of data types.

5
New cards

What is a graph?

A data structure that consists of a set of vertices (nodes) and with edges (relations) between them.

6
New cards

What is considered an adjacent vertex?

When there is an edge from one vertex to the other vertex.

7
New cards

What is a simple graph?

A graph where there are no parallel edges and self loops.

8
New cards

What is the degree of a vertex?

The number of edges in a vertex.

9
New cards

In a directed graph, what is the in-degree and out-degree of a vertex?

The number of incoming and outcoming edges.

10
New cards

What is considered a simple path?

A path where all the vertices and edges are distinct.

11
New cards

What is a cycle?

A path with distinct vertices, but the starting and end vertex are identical.

12
New cards

What is an adjacency matrix?

A square grid of true/false values that represent the edges of a graph.

13
New cards

What is a directed acyclic graph?

A digraph that has no directed cycles.

14
New cards

How do you perform a topological ordering (topological sort) of a digraph?

List them in the way that all predecessors are accessed before moving forward.

15
New cards

If we have a directed graph represented as an adjacency matrix where the adjacency of two vertices is defined by Boolean variables, how do we determine the number of Boolean variables necessary?

16
New cards

Why is the state graph for tic-tac-toe a directed graph rather than an undirected graph?

Once a move is made, it cannot be unmade.

17
New cards

What defines a subgraph of a graph?

The vertices and the edges of the subgraph are a subset of the vertices and edges of the graph.

18
New cards

What is a spanning subgraph?

The subgraph contains all the vertices of the graph.

19
New cards

What is a traversal?

A systematic procedure for exploring a graph by examining all of its vertices and edges.

20
New cards

What makes a traversal efficient?

If it visits all vertices and edges in time proportional to their number in linear time.

21
New cards

What does a depth-first search use?

It uses a stack to keep track of vertices that still need to be visited.

22
New cards

How do you perform a depth-first search?

Start at the initial vertex, visit it. Choose an adjacent vertex to visit until there are no more adjacent vertices. If not, add it to the post order sequence and go back to the predecessor.

23
New cards

In a depth-first search, what do you do once all vertices have been visited?

It would be inefficient to keep checking, so we pop them from the stack and add them to the post order sequence.

24
New cards

What does a breadth-first search use?

It uses a queue to keep track of vertices that still need to be visited.

25
New cards

How do you perform a breadth-first search?

Start at the initial vertex and mark it as visited. Find all adjacent vertexes and add them to the queue. Pop the first vertex and mark it as visited. Repeat until there are no more vertices to visit.

26
New cards

What does Dijkstra’s algorithm do?

It computes the distsances of all vertices from a given initial vertex to find the shortest path.

27
New cards

How does Dijkstra’s algorithm work?

It finds the shortest path from an initial vertex by repeatedly choosing unvisited nodes with the smallest known distance. It will update its neighbors’ distances until all nodes are processed.

28
New cards

What is a minimum spanning tree?

A spanning tree of a weighted graph with minimum total edge weight.

29
New cards

How does Kruskal’s algorithm work?

It builds a minimum spanning tree by repeatedly adding the smallest-weight edge that connects two previously unconnected components. It stops when all vertices are connected.

30
New cards

How is Kruskal’s algorithm a greedy algorithm?

At each step, it greedily chooses the smallest edge available that does not create a cycle.

31
New cards