Deck 5: Methods
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/17
Play
Full screen (f)
Deck 5: Methods
1
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
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
A
2
Show the inorder, preorder, and postorder of the following BST. 


3
A _________ is the one in which every two pairs of vertices are connected.
A) complete graph
B) weighted graph
C) directed graph
A) complete graph
B) weighted graph
C) directed graph
A
4
Show the BST after deleting 15 from the following BST.
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
5
Find all shortest paths starting from vertex A in the following graph.
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
6
Show the BST after inserting 45, 43, 100, 34, 23, and 3 into an empty BST.
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
7
Show the BST after deleting 60 from the following BST.
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
8
The time complexity of the DFS algorithm is 
A) true
B) false

A) true
B) false
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
9
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
D) breadth-first traversal
A) postorder traversal
B) preorder traversal
C) inorder traversal
D) breadth-first traversal
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
10
A ___________ of a graph is a subgraph that is a tree and connects all vertices in the graph.
A) spanning tree
B) shorted path
A) spanning tree
B) shorted path
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
11
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
A) loop
B) parallel edge
C) weighted edge
D) directed edge
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
12
A ____ is an edge that links a vertex to itself.
A) loop
B) parallel edge
C) weighted edge
D) directed edge
A) loop
B) parallel edge
C) weighted edge
D) directed edge
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
13
Draw a DFS tree from the following graph starting from vertex E.
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
14
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)
A) O(logn)
B) O(nlogn)
C) O(n)
D) O(1)
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
15
A graph may have several minimum spanning tree.
A) true
B) false
A) true
B) false
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
16
Draw a BFS tree from the following graph starting from vertex E.
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck
17
Find a MST in the following graph.
Unlock Deck
Unlock for access to all 17 flashcards in this deck.
Unlock Deck
k this deck