Data Structure & Algorithms - End Semester Examination - 2022
Data Structure & Algorithms
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
-
In a stack, if a user tries to remove an element from empty stack it is called:
-
Consider the binary max-heap implemented using an array. Which one of the following array represents the heap:
-
A hash function is defined as h(key) = key mod 7, with linear probing used to insert keys 44, 45, 79, 55, 91, 18, 63 into a table indexed from 0 to 6. What will be the location of key 18?
-
If the number of values to be sorted is already partially sorted, then ______ sorting can be efficient.
-
The time complexity of merge sort is:
-
State true or false: A: Binary search is used for searching in a sorted array. B: The time complexity of binary search is \( O(\log n) \).
-
In a circular linked list organization, insertion of a record involves modification of:
-
Level order traversal of a rooted tree can be done by starting from the root and performing:
-
An Abstract Data Type (ADT) is:
-
How many distinct BSTs can be constructed with 3 distinct keys?
-
Explain different asymptotic notations (Big-O, \( \Omega \), \( \Theta \)) used for comparing the time complexity of an algorithm with neat figures.
-
The run time of an algorithm is represented by the recurrence relation \( T(n) = 2T(n/2) + n \); \( n \ge 2 \) and with boundary condition \( T(1) = 0 \). What is the time complexity (in terms of \( \Theta \) notation).
-
Discuss pre-order, in-order and post-order traversal techniques of binary tree. Write a C function for non-recursive pre-order traversal.
-
The pre-order traversal sequence of a Binary Search Tree (BST) is 30, 20, 10, 15, 25, 23, 39, 35, 42. Write step by step process to derive the BST and find post-order traversal also.
-
Consider a circular queue of capacity n-elements implemented with an array. Write C functions for insertion and deletion operations.
-
Convert the given infix expression into postfix using stack: \( A + B / C * (D + E) - F \). For each input symbol clearly mention the action taken and status of the stack during conversion.
-
Write a C function to delete last node from a singly linked list.
-
Create a max-heap by inserting following keys in the given order. Show each insertion step with clear illustration: 25, 35, 18, 9, 46, 70, 48.
-
Write an algorithm for merge sort and discuss space and time complexity.
-
Define collision in hashing. Explain briefly different methodologies to resolve collision.
-
Write algorithm to count leaf nodes in binary tree. What is the complexity of your algorithm?
-
Compare BFS and DFS traversal techniques for graph. Write an algorithm to perform BFS using queue.
-
Differentiate between system defined data types and abstract data types with suitable examples.
-
What is doubly linked list? What are its applications? Explain how a node can be added as last node using appropriate pseudo code.
-
AVL Rotations
-
Open Addressing & Chaining
-
B-Tree
-
Priority Queue