Lab External Questions
1. A. Implement Binary Search Tree and Perform the following
operations
i. Insert
ii. Search
iii. Delete
iv. In-order
B. Write a program to implement merge sort for the following array.
Array: ["apple", "banana", "grape", "cherry", "date"]
A. Implement Binary Search Tree and Perform the following
operations
Lab External Questions
Lab External Questions
Lab External Questions
Lab External Questions
Lab External Questions
B.Write a program to implement merge sort for the following
array.
Array: ["apple", "banana", "grape", "cherry", "date"]
Lab External Questions
Lab External Questions
Lab External Questions
2. A. Write a Program to implement Quick Sort for Sorting an Array of
Structures for given input.
Array of Structures:
1. Name: "Alice", Score: 50
2. Name: "Bob", Score: 80
3. Name: "Charlie", Score: 70
4. Name: "David", Score: 90
B. Write a program to implement the Towers of Hanoi problem using
recursion.
A. Write a Program to implement Quick Sort for Sorting an
Array of Structures for given input.
Array of Structures:
1. Name: "Alice", Score: 50
2. Name: "Bob", Score: 80
3. Name: "Charlie", Score: 70
4. Name: "David", Score: 90
Lab External Questions
Lab External Questions
B.Write a program to implement the Towers of Hanoi problem
using recursion.
Lab External Questions
3. A. Write a program to solve the Fractional Knapsack Problem for
multiple test cases.
Number of test cases: 2
Test case 1:
Number of items: 3
Items (Value, Weight): [(60, 10), (100, 20), (120, 30)]
Knapsack capacity: 50
Test case 2:
Number of items: 4
Items (Value, Weight): [(60, 10), (40, 40), (100, 20), (120, 30)]
Knapsack capacity: 50
B. Write a program to implement Dijkstra’s Algorithm to find the
shortest path from a source vertex to all other vertices in a
weighted, directed graph.
Number of vertices: 5
Graph (Adjacency Matrix):
0 10 0 0 20
10 0 10 0 0
0 10 0 30 0
0 0 30 0 0
20 0 0 0 0
Source vertex: 0
Lab External Questions
A. Write a program to solve the Fractional Knapsack Problem for
multiple test cases.
Number of test cases: 2
Test case 1:
Number of items: 3
Items (Value, Weight): [(60, 10), (100, 20), (120, 30)]
Knapsack capacity: 50
Test case 2:
Number of items: 4
Items (Value, Weight): [(60, 10), (40, 40), (100, 20), (120, 30)]
Knapsack capacity: 50
Lab External Questions
Lab External Questions
Lab External Questions
B. Write a program to implement Dijkstra’s Algorithm to find the
shortest path from a source vertex to all other vertices in a weighted,
directed graph.
Number of vertices: 5
Graph (Adjacency Matrix):
0 10 0 0 20
10 0 10 0 0
0 10 0 30 0
0 0 30 0 0
20 0 0 0 0
Source vertex: 0
Lab External Questions
Lab External Questions
4. A. Write a program to verify whether the given graph is connected
before finding the Minimum Spanning Tree using Prim’s
Algorithm or Kruskal’s Algorithm.
Number of vertices: 4
Graph (Adjacency Matrix):
0100
1010
0101
0010
B. Write a program to implement Huffman Coding for a given set of
characters and their frequencies.
Character and frequency pairs:
A: 5, B: 9, C: 12, D: 13, E: 16, F: 45
Lab External Questions
A. Write a program to verify whether the given graph is connected
before finding the Minimum Spanning Tree using Prim’s Algorithm
or Kruskal’s Algorithm.
Number of vertices: 4
Graph (Adjacency Matrix):
0100
1010
0101
0010
Lab External Questions
Lab External Questions
Lab External Questions
B.Write a program to implement Huffman Coding for a given set of
characters and their frequencies.
Character and frequency pairs:
A: 5, B: 9, C: 12, D: 13, E: 16, F: 45
Lab External Questions
Lab External Questions
Lab External Questions
Lab External Questions
Lab External Questions
5. A. Find the Transitive closure of a given directed graph using
Warshall’s algorithm.
B. Write a Program to Implement Floyds Algorithm.
Lab External Questions
A. Find the Transitive closure of a given directed graph using
Warshall’s algorithm.
Lab External Questions
B. Write a Program to Implement Floyds Algorithm.
Lab External Questions
Lab External Questions
6.Write a program to solve multiple instances of the 0/1 Knapsack
problem using the Dynamic Programming approach.
Test case 1:
Number of items: 4
Item Weights: [1, 3, 4, 5]
Item Values: [1, 4, 5, 7]
Knapsack Capacity: 7
Test case 2:
Number of items: 3
Item Weights: [2, 3, 4]
Item Values: [3, 4, 5]
Knapsack Capacity: 5
Lab External Questions
Lab External Questions
7.Print all the nodes reachable from a given starting node “B” in a given
Undirected graph using BFS, DFS method.
Lab External Questions