Skip to content

Algorithm

CIS · Quiz · Summer 25

Batch 20

This browser can’t show the PDF here

Open it, and your phone’s PDF viewer takes it, or download it.

Read the questions as text

Read off the PDF by AI, so it may have mistakes. The PDF is the original.

Quiz-1 Examination: Summer-2025 Course Code: CIS 212 (Batch: 20) Course Title: Algorithm Time: 30 Minutes Total Marks: 15 1. What is complexity? Determine the time complexity of the following code using Big-O notation. 5 A. for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < 1000; k++) { cout << i * j * k << endl; } } } B. for (int i = n; i > 0; i /= 2) { for (int j = 0; j < n; j++) { cout << i + j << endl; } } 2. Trace the steps to sort [38, 27, 43, 3, 9, 82, 10] using Merge Sort. Show the recursion tree for splitting and merging. 5 3. Is Merge Sort an InPlace algorithm? Give a comparative analysis of Insertion, Merge & Quick Sort for: A. Best Case. B. Worst Case. 5 Quiz-2 Examination: Summer-2025 Course Code: CIS 212 (Batch: 20) Course Title: Algorithm Time: 30 Minutes Total Marks: 15 1. A binary tree T has 9 nodes. The inorder and preorder traversals of T yield the following sequences of nodes: 5 Inorder: E A C K F H D B G Preorder: F A E K C D H G B I. Draw the tree T. II. Find the order of tree T. III. Listed the leaf nodes of tree T. IV. Listed the siblings of node K. V. Show the internal vertices of the tree. 2. Define DAG(Directed Acyclic Graph). 5 Construct an adjacency matrix and adjacency list for the directed graph. [Figure: A directed graph with 5 nodes labeled 1, 2, 3, 4, 5 and directed edges between them.] 3. [Figure: A directed/undirected graph with nodes A, B, C, D, E, F.] 5 Apply Breadth First Search (BFS) and Depth First Search(DFS) algorithm and find the order of visiting nodes. Start Node= A. Quiz-3 Examination: Summer-2025 Course Code: CIS 132 (Batch: 20) Course Title: Algorithm Time: 30 Minutes Total Marks: 15 1. [Figure: A directed graph with nodes 1, 2, 3 and weighted edges.] 5 Compute the initial matrices A^(0) and final matrices A^(k) to determine the all pair shortest paths using Floyd Warshall Algorithm. 2. How does the Bellman-Ford algorithm detect negative-weight cycles? Explain the condition used for this check. 5 What do you mean by Relaxation? Write the pseudocode for Relaxation. 3. [Figure: A graph with nodes A, B, C, D, E and weighted edges between them.] 5 Apply Dijkstra algorithm on the given graph. Source node=A. Show the Queue states and Order of visiting nodes.