Hashing Question Bank
Showing 40 questions of 40 with verified answers
(Calculation) In an AVL tree, if a node has a Left Subtree of height 3 and a Right Subtree of height 1, what Rotation is required to fix the balance?
(Conceptual) Which binary tree traversal is also known as a Breadth-First Search (BFS)?
(Scenario-Based) An expression tree represents (3 + 5) * 2. Which traversal will yield the correct **Postfix** notation 3 5 + 2 *?
(Calculation) What is the height of a Complete Binary Tree with 15 nodes? (Assume root is at height 0).
(Conceptual) In a **Max-Heap** (which is a special type of complete binary tree), where is the largest element always located?
(Debugging) While searching for value 40 in a BST, you visit nodes in this order: 10, 50, 20, 30, 45, 35. Is this a valid search path?
(Conceptual) What is the time complexity of Level-order traversal in a tree with N nodes?
(Code-Tracing) Trace the output of **Post-order** traversal for a tree where A is Root, B is Left Child, and C is Right Child.
(Scenario-Based) A database index uses a **B-Tree** instead of a simple BST. What is the main reason?
(Conceptual) What happens during a Left Rotation (RR) in an AVL tree?
(Comparison) How many NULL pointers are there in a Binary Tree with N nodes?
(Scenario-Based) You have a Complete Binary Tree stored in an Array. If a node is at index i (1-based indexing), where is its Left Child?
(Conceptual) What is a Threaded Binary Tree?
(Calculation) What is the minimum number of nodes in an AVL tree of height 3? (Assume height of single node is 0).
(Conceptual) In a **Red-Black Tree**, which is true?
(Scenario-Based) Which data structure is used to implement a Trie (Prefix Tree)?
(Conceptual) Which data structure is primarily used to implement Breadth-First Search (BFS)?
(Scenario-Based) You are representing a social network with 1 billion users, where each user has an average of 100 friends. Which graph representation should you use to save memory?
(Calculation) What is the Time Complexity of performing a DFS traversal on a graph with V vertices and E edges represented as an Adjacency List? •
(Code-Tracing) During a DFS on a Directed Graph, you encounter an edge (u, v) where v is already in the current recursion stack. This indicates:
(Conceptual) Which algorithm is the best choice for finding the shortest path between a single source and all other nodes in a graph with negative edge weights?
(Calculation) How many edges are in a Complete Undirected Graph with n vertices?
(Scenario-Based) A GPS system needs to find the fastest route from Point A to Point B. All road distances are positive. Which algorithm is most likely used?
(Conceptual) What is a Topological Sort of a Directed Acyclic Graph (DAG)?
(Comparison) What is the primary difference between **Kruskal's** and **Prim's** algorithms for finding an MST?
(Code-Tracing) In a graph representation using an Adjacency Matrix adj[V] [V], how do you check if an edge exists between node 3 and node 5?
(Conceptual) A graph is "Disconnected" if:
(Scenario-Based) You need to detect if a "Deadlock" exists in an Operating System. You model the resources and processes as a directed graph. A deadlock exists if:
(Calculation) What is the time complexity of the Floyd-Warshall algorithm?
(Conceptual) In the context of Union-Find (used in Kruskal's), what is the purpose of "Path Compression"?
(Debugging) You run Dijkstra's on a graph and it enters an infinite loop or gives a wrong answer. What is the most likely cause?
(Conceptual) What is the "In-degree" of a vertex in a directed graph?
(Calculation) In a graph with 5 vertices, what is the maximum possible value in its **Adjacency Matrix** (assuming unweighted)?
(Scenario-Based) You want to find the minimum length of a cable needed to connect all houses in a neighborhood so that everyone has internet access. This is a problem of finding:
(Conceptual) What does it mean if a Directed Graph is "Strongly Connected"?
(Code-Tracing) Trace the result of **Kruskal's Algorithm** on three edges: (A-B, 5), (B-C, 10), (A-C, 2). Which edge is picked first?
(Conceptual) Which algorithm is used to find Strongly Connected Components (SCCs) in a directed graph?
(Calculation) What is the Space Complexity of an **Adjacency Matrix** for a graph with V vertices?
(Scenario-Based) You are using BFS to find the shortest path in a graph where all edges have a weight of 10. Will BFS find the correct path?
What is the primary drawback of open addressing with linear probing in a Hash Table when the load factor becomes high?