1
Name:_______________________
Covers
50 min
CSCI 2410 Data Structures and Algorithms
Armstrong Atlantic State University
Instructor: Y. Daniel Liang
Part I: Multiple Choice Questions: (1 pts each)
1. (2 pts) Show the BST after inserting 45, 43, 100, 34,
23, and 3 into an empty BST.
A:
45
root
2. (2 pts) Show the BST after deleting 15 from the
following BST.
2
60
root
3. (2 pts) Show the BST after deleting 60 from the
following BST.
A:
57
root
4. (3 pts) Show the inorder, preorder, and postorder of the
following BST.
3
60
root
A:
inorder: 15 49 57 60 64 67 100 107
5. (2 pts) Draw a DFS tree from the following graph
starting from vertex E.
A
B
C
E
D
6. (2 pts) Draw a BFS tree from the following graph
starting from vertex E.
4
A
B
C
E
D
7. (2 pts) Find a MST in the following graph.
A
B
C
E
D
1
2
3
F
G
4
5
6
7
8
9
10
11
12
8. (2 pts) Find all shortest paths starting from vertex A
in the following graph.
5
A
B
C
E
D
1
2
3
F
G
4
5
6
7
8
9
10
11
12
6
Part II: Multiple Choice Questions: (1 pts each)
(Take the multiplechoice questions online from LiveLab
before midnight today. Log in and click Take Instructor
Assigned Quiz Quiz2. You have to take it before it is due.
You have to submit it within 20 minutes.)
1. The ________ is to visit the left subtree of the current node first, then the current node itself, and finally the right
subtree of the current node.
a. postorder traversal
b. preorder traversal
c. inorder traversal
#
2. The time complexity for finding an element in a binary search tree is _________.
a. O(logn)
b. O(nlogn)
c. O(n)
d. O(1)
#
3. To add a new node, you need to start a process by first placing it as _______ and move it up to maintain the heap
property.
a. the last node in the heap
b. the new root
c. the right child of the root
d. the left child of the root
#
4. The time complexity of the DFS algorithm is O(|E| + |V|).
a. true
b. false
#
5. A ____ is an edge that links a vertex to itself.
a. loop
b. parallel edge
c. weighted edge
d. directed edge
Key:a
#
6. If two vertices are connected by two or more edges, these edges are called ______.
a. loop
b. parallel edge
c. weighted edge
d. directed edge
#
7. A _________ is the one in which every two pairs of vertices are connected.
a. complete graph
7
b. weighted graph
c. directed graph
#
8. A graph may have several minimum spanning tree.
a. true
b. false
#
9. A ___________ of a graph is a subgraph that is a tree and connects all vertices in the graph.
a. spanning tree
b. shorted path