JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA 2022 DATA STRUCTURES AND ALGORITHMS Previous Question Paper (October/November - 2022 - R15)
Answer any five questions
All questions carry equal marks
Main
Briefly explain about the following Asymptotic notations.
i) Big O ii) Omega iii) Theta
Answer
Asymptotic notations are mathematical tools used to describe the limiting behavior of a function, typically representing the time or space complexity of an algorithm.
i) Big O notation (O): Provides an asymptotic upper bound on the growth rate of a function. It represents the worst-case scenario. Formally, f(n) = O(g(n)) if there exist positive constants c and n0 such that 0 ≤ f(n) ≤ c·g(n) for all n ≥ n0.
ii) Omega notation (Ω): Provides an asymptotic lower bound on the growth rate of a function. It represents the best-case scenario. Formally, f(n) = Ω(g(n)) if there exist positive constants c and n0 such that 0 ≤ c·g(n) ≤ f(n) for all n ≥ n0.
iii) Theta notation (Θ): Provides an asymptotic tight bound on the growth rate of a function. It represents the average or exact growth rate. Formally, f(n) = Θ(g(n)) if there exist positive constants c1, c2, and n0 such that c1·g(n) ≤ f(n) ≤ c2·g(n) for all n ≥ n0.
Write a program to implement stack ADT using arrays.
Answer
A stack is a Last-In-First-Out (LIFO) data structure. The following C implementation uses an array to perform push, pop, and peek operations.
#include <stdio.h>
#define MAX 100
int stack[MAX], top = -1;
void push(int val) {
if (top == MAX - 1) printf("Stack Overflow\n");
else stack[++top] = val;
}
int pop() {
if (top == -1) { printf("Stack Underflow\n"); return -1; }
return stack[top--];
}
void display() {
for(int i = top; i >= 0; i--) printf("%d ", stack[i]);
printf("\n");
}
int main() {
push(10); push(20);
display();
printf("Popped: %d\n", pop());
return 0;
}Briefly explain the following Doubly Linked List operations
Insertion
Answer
Sign in to view the complete answer paper.
Deletion
Answer
Sign in to view the complete answer paper.
Briefly explain about Union and Find operations.
Answer
Sign in to view the complete answer paper.
Write a short note on priority Queue.
Answer
Sign in to view the complete answer paper.
Write and explain the DFS algorithm with an example.
Answer
Sign in to view the complete answer paper.
Discuss about Binary Search with an example.
Answer
Sign in to view the complete answer paper.
Briefly explain the Linear Probing with an example.
Answer
Sign in to view the complete answer paper.
Explain the following sorting techniques
Radix Sort
Answer
Sign in to view the complete answer paper.
Merge sort
Answer
Sign in to view the complete answer paper.
What is Splay Tree? Explain the delete operation on Splay Tree.
Answer
Sign in to view the complete answer paper.
Construct the B - Tree of order 2 for the following data {5, 2, 6, 3, 9, 1, 4, 8, 7}
Answer
Sign in to view the complete answer paper.
Write and explain the Kruskal’s Algorithm for Minimum cost Spanning tree.
Answer
Sign in to view the complete answer paper.
Write a short note on Standard Tries, Compressed Tries and Suffix tries.
Answer
Sign in to view the complete answer paper.