0% found this document useful (0 votes)
21 views3 pages

Unit 4-1 Marks

The document contains a series of short answer questions related to tree and graph data structures, defining key concepts such as binary search trees, AVL trees, B-trees, and various tree traversals. It also discusses the properties and applications of these structures, as well as differences between related concepts like height and depth, and DFS and BFS. Additionally, it outlines the advantages of AVL trees over binary search trees and lists the applications of trees and graphs.

Uploaded by

muthakanilikitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Unit 4-1 Marks

The document contains a series of short answer questions related to tree and graph data structures, defining key concepts such as binary search trees, AVL trees, B-trees, and various tree traversals. It also discusses the properties and applications of these structures, as well as differences between related concepts like height and depth, and DFS and BFS. Additionally, it outlines the advantages of AVL trees over binary search trees and lists the applications of trees and graphs.

Uploaded by

muthakanilikitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Unit – 4 Short Answer Questions

1. Define path in a tree.


A path in a tree is a sequence of nodes and edges that connect one node to another.

2. Define binary search tree.


A BST is a binary tree where each node's left child contains values smaller than the node,
and the right child contains values larger than the node.

3. List the different tree traversals.


• Inorder (Left, Root, Right)
• Preorder (Root, Left, Right)
• Postorder (Left, Right, Root)
• Level order (Breadth-wise traversal)

4. What is meant by height of a binary search tree?


The height of a BST is the length of the longest path from the root node to a leaf node.

5. Differentiate between height and depth of a tree.


• Height: The longest path from a node to a leaf.
• Depth: The path length from the root to a specific node.

6. Define complete binary tree.


A binary tree where all levels are fully filled, except possibly the last, and nodes are as far
left as possible.

7. What is the purpose of a height balanced tree?


For ensuring that operations like searching, insertion, and deletion can be performed
efficiently with a time complexity of O(log n) by minimizing the height of the tree

8. What is an AVL tree? Mention its rotations.


An AVL tree is a height-balanced binary search tree where the difference in height
between left and right subtrees (balance factor) is at most 1.
Rotations: Left-Left Rotation, Right-Right Rotation, Left-Right Rotation, Right-Left
Rotation.

9. Define B-Tree.
A B-Tree is a self-balancing search tree where nodes can have multiple children,
maintaining sorted order and efficient search, insert, and delete operations.

10. Define B+ Tree.


A B+ Tree is a variant of the B-Tree where all values are stored in leaf nodes, and internal
nodes only contain keys to guide searches.

11. Mention the advantages of B+ tree over B-Tree.


• Faster sequential access due to linked leaf nodes.
• All data stored in leaf nodes, providing uniform search time.

12. Define priority queue (heap). What is the need for priority queue?
A priority queue is a special type of queue where each element is associated with a
priority, and elements are dequeued based on their priority rather than their order of
arrival.
Need for Priority Queue:
• Task scheduling (e.g., CPU scheduling).
• Handling jobs or events based on urgency (e.g., hospital emergency rooms).
A heap is a binary tree-based data structure used to implement a priority queue. It
satisfies the heap property

13. What is a Maxheap/Minheap?


Maxheap: Heap in which the parent node has a value greater than or equal to its children.
Minheap: Heap in which the parent node has a value smaller than or equal to its children.

14. Write the steps in heap sort


i. Build a maxheap from the input array.
ii. Swap the root with the last element.
iii. Reduce the heap size and heapify the root.
iv. Repeat until the heap size is 1.

15. List any two differences between graphs and trees.


• A tree has no cycles, while a graph can have cycles.
• Trees are connected, but graphs can be disconnected.

16. What is a directed acyclic graph?


A graph with directed edges and no cycles.

17. Define a Graph.


A graph is a collection of vertices (nodes) connected by edges.

18. What is connected component?


A connected component is a subgraph of a given graph where there will be a path between
every pair of vertices.

19. Define spanning tree of a graph.


A spanning tree of a graph is a subgraph of the graph that is a tree and contains every
vertex of the graph

20. Define in-degree and out-degree of nodes in a graph.


• In-degree: Number of edges entering a vertex.
• Out-degree: Number of edges leaving a vertex.

21. Differentiate between DFS and BFS.


• DFS (Depth-First Search): Explores as far as possible along each branch before
backtracking.
• BFS (Breadth-First Search): Explores all neighbors at the current depth before
moving to the next depth.

22. What is the role of balance factor in AVL trees?


It ensures the tree is balanced by checking the height difference of left and right subtrees,
which must not exceed 1.

23. List the properties of binary trees.


• A binary tree has at most two children for each node.
• The number of nodes at level i is at most 2^i.
• The total nodes in a tree of height h is at most 2^(h+1) −1.

24. What is a full binary tree?


A binary tree where every node has either 0 or 2 children.

25. Mention the properties of a B-tree.


• All leaves are at the same level.
• Every node except the root must be at least half filled.
• All keys of a node are sorted in increasing order. The child between two
keys k1 and k2 contains all keys in the range from k1 and k2.
• In a B-tree of order p, all nodes (including root) may contain at most (p – 1) keys.

26. What is a height balanced tree?


A tree where the difference in heights of the left and right subtrees is at most 1 for all nodes.

27. List the applications of trees.


• Database indexing
• Expression parsing
• File systems
• Network routing

28. List the applications of graphs.


• Shortest path algorithms (e.g., Google Maps)
• Network flow problems
• Dependency analysis

29. Give adjacency matrix representation for the following graph:

30. Write the advantages of AVL trees compared to binary search trees.
• AVL trees are always balanced, ensuring O(log⁡n)O(\log n)O(logn) time for search,
insertion, and deletion.
• Prevents skewed trees, which degrade performance in binary search trees.

You might also like