Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Scottish Church College

Internal Assessment Examination - 2022


Algorithms and Data Structure
Semester II (General)
CMSG
Paper: CC-2

Time: 1 Hour Full Marks: 30

Answer any Six (6) Questions

1. i. Write an algorithm to delete a node from the beginning of a doubly linked list? [3+2]

ii. What are the main differences between the Linked List and Linear Array?

2. i. Write an algorithm to insert a node to the end of a singly linked list? [3+2]

ii. Write an algorithm to count the number of nodes in a singly linked list?

3. i. Why is stack known as LIFO? [2+3]

ii. Write an algorithm of pop operation on the stack?

4. i. Consider the following operation performed on a stack of size 6. [2+3]


Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operations, how many numbers of elements are present
in the stack?

ii. Convert infix expression to prefix expression:


(A - B) * ((C - D) * E) * F / G

5. i. There is a sorting method which checks if every two consecutive elements [4+2]
are in order. Name the method and use it to sort the given array a[5]={75, -2 0,
53, 32} in descending order.

ii. State the drawback of the linear search mechanism. How can it be overcome?

6. i. Write an algorithm to search for ‘x’ from a given array of integers arr[], using the [4+1]
binary search technique.

ii. What is the prerequisite to applying a binary search algorithm?

7. i. Define a binary search tree. [2+2+1]


ii. Insert the following elements into an empty BST - 7, 5, 1, 8, 3, 6, 0, 9, 4, 2. Show
each step clearly.

iii. What is the in-order traversal sequence of the resultant tree?

8. i. Distinguish between full and complete binary trees with proper examples. [2+3]

ii. The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23,
39, 35, 42. What is the postorder traversal sequence of the same tree?

You might also like