Trees and Forests
This quiz covers various concepts related to trees and forests in graph theory.
Questions
Which of the following statements is true about a tree?
- It is a connected graph.
- It has no cycles.
- It has a unique path between any two vertices.
- All of the above.
What is the maximum number of edges in a tree with n vertices?
- n-1
- n
- n+1
- 2n-1
Which of the following is a forest?
- A graph with no cycles.
- A graph with no isolated vertices.
- A graph in which every connected component is a tree.
- All of the above.
What is the minimum number of edges in a forest with n vertices?
- 0
- 1
- n-1
- n
Which of the following algorithms can be used to find a minimum spanning tree of a weighted graph?
- Kruskal's algorithm
- Prim's algorithm
- Dijkstra's algorithm
- Floyd-Warshall algorithm
What is the time complexity of Kruskal's algorithm for finding a minimum spanning tree?
- O(E log E)
- O(E log V)
- O(V log V)
- O(V^2)
Which of the following is a property of a binary tree?
- It has at most two children for each node.
- It has a unique path from the root to each node.
- It is a complete tree.
- All of the above.
What is the maximum number of nodes in a complete binary tree of height h?
- 2^h
- 2^(h+1) - 1
- 2^(h+1)
- 2^(h+2) - 1
Which of the following is a traversal method for a binary tree?
- Inorder traversal
- Preorder traversal
- Postorder traversal
- All of the above.
What is the time complexity of inorder traversal of a binary tree?
- O(log V)
- O(V)
- O(V log V)
- O(V^2)
Which of the following is a type of tree data structure?
- Binary search tree
- Red-black tree
- AVL tree
- All of the above.
What is the property of a binary search tree?
- The left child of a node is always smaller than the node.
- The right child of a node is always larger than the node.
- Both of the above.
- None of the above.
Which of the following is a type of forest data structure?
- Trie
- Suffix tree
- Patricia tree
- All of the above.
What is the property of a trie?
- It is a tree-like data structure.
- It is used for storing strings.
- It allows for efficient searching and retrieval of strings.
- All of the above.
Which of the following is a type of tree decomposition?
- Nice tree decomposition
- Path decomposition
- Treewidth decomposition
- All of the above.