Dsa Slved Pprs
Dsa Slved Pprs
a) "Binary tree contains every node with minimum two child nodes".
Answer: A binary tree where each node has only left child and no right child.
Answer: A tree in which all levels are completely filled except possibly the last, which is filled left to
right
Answer: Should distribute keys uniformly, avoid clustering, and be fast to compute.
Answer: True. That's the formula for number of edges in a complete undirected graph.
In splay tree, recently accessed node is moved to the root using rotations.
Answer: The Mid-Square method is a hashing technique used to determine the address (or
index) of a key in a hash table. It works by:
Example:
56=3136
• Since we want a 2-digit address (because table size is 100), we take the middle 2 digits of
3136.
• 3136 → Middle two digits = 13
Answer: An Inverse Adjacency List is a variation of the adjacency list used in graph data structures —
specifically useful for directed graphs.
return 1;
return root;
Answer:
d) In B+ tree data can only be stored in leaf node. State true or false.
True.
• Left Rotation
• Right Rotation
• Left-Right Rotation
• Right-Left Rotation
• Kruskal's Algorithm
• Prim's Algorithm
j) What is hashing?
Hashing is a process of converting a given key into an index in an array using hash functions.
Q2) Attempt any four of the following: [4 × 2 = 8]
A self-balancing tree used in databases and file systems. Each node can have more than two
children. Keeps data sorted and allows logarithmic search, insertion, and deletion. In B Tree, data
is stored at both internal and leaf nodes
Q3) Attempt any two of the following: [2 × 4 = 8]
#include <stdio.h>
#define V 4
int main() {
int graph[V][V] = {
{1, 1, 1, 0},
{0, 1, 1, 0},
{1, 0, 1, 1},
{0, 0, 0, 1}
};
int i, j, in, out;
#include <stdio.h>
#define SIZE 10
int hashTable[SIZE];
int main() {
insert(23);
insert(43);
insert(13);
for (int i = 0; i < SIZE; i++)
printf("%d ", hashTable[i]);
return 0;
}
Terminal Node:
A terminal node, also called a leaf node, is a node that has no children. It is the end point of a
branch in a tree.
Depth of a Node:
The depth of a node is the number of edges from the root node to that particular node. The
root has a depth of 0.
Root Node:
The root node is the top-most node of a tree. It is the starting point from which all other nodes
branch out.
Q4, 5.b