Sunteți pe pagina 1din 3

B.E.

(ECE) 4th Sem


Data Structures & Algorithms
NOTE:- (i) Attempt any 5 questions selecting at least two from part-A & part-B.

PART-A
Q1. (a) What do you mean by data structure?List down various operations
possible on data structures? (8)

(b) What do you mean by complexity? Discuss different types of complexity. (8)

(c) What is garbage collection? (4)

Q2. (a) Show how to implement a queue by using an array Queue[50], where
Queue [0] & Queue [1] are always used to indicate front & rear of queue ,
respectively . Write algorithms for inserting & deleting an element from above
queue. (8)

(b) Explain how to implement two stacks in one array A[N] in such a way that
neither stack overflows unless the total number of elements in both stacks
together is ‘N’. Push & Pop operations should run in O(1) time. (12)

Q3. (a) Select the appropriate data structure to implement the following.
Explain why you selected it.

(i) To store the addresses of recently visited sites in an internet web


browser. And then to implement operation of “back” button.

(ii) To implement “Undo” operation in a text editor. “Undo” operation


cancels recent editing operations & revert to former states of a document. (5)

(b) If a stack is implemented using an array of size 4, then describe the


output for the following sequence of queue operations:

Push(5), push(8), pop(), push(59), push (90), push(100), push(20),


pop(),push(30),push(10) (5)
(c) Convert the following infix expression into postfix & then evaluate the
post fix expression using conversion algorithms :

12+(((15-10)*(4-2)+10)/5)/2*(8-6) (10)

Q4. (a) Let X=(x1,x2,x3,……….,xn) & Y=(y1,y2,y3,…..,ym) be two linked lists . how you
will merge the two lists to obtain the linked list. How you will merge the
two lists to obtain the linked list Z=(x1,y1,x2,y2,x3,y3………,xm,ym,xm-1…..xn) if m<=n
OR Z=(x1,y1,x2,y2,x3,y3………,xn,yn,yn+1…..ym) if m>n . here x1 & y1 ‘s are information
parts. (12)

(b) What is sparse matrix? How it can be represented by linked list?

PART-B
Q5. (a) Explain the in–order method of tree traversal with recursive program. (5)

(b) What is time complexity for inserting one node into binary tree?Give
reason for answer. (5)

(c) When & Why AVL trees are preferred over binary search trees?
Build an AVL tree with following values : 11, 14,15,17,18,19,4,5,1,8. (10)

Q6. (a) What do you mean by graph traversal? Explain depth first search
algorithm. (10)

(b) What is B-tree? Construct a B-Tree with following values : 5, 1, 2, 6 ,8, 3, 9,


10, 23, 4. Order of B-tree is 3. (10)

Q7.(a) Write the ‘c’ code to implement following function : void merge (int
data[] , int n1, int n2); Pre-condition: the first ‘n1’ element of data are sorted
& the next ‘n2’ elements of data are sorted(from smallest to largest).

Post-condition: the n1+n2 elements of data are now completely sorted. (5)

(b) Write algorithm for binary search . How many comparisons are required
to search ‘12’ in following list of values by using binary search algorithm: 10,
12, 15, 17, 20, 30, 40, 50, 60, 70, 80, 90? (8)
(c) How can graphs be represented in memory? (7)

Q8.(a) Fill efficiency of sorting algorithm in the following table.

Best Case Worst Case Average Case


Insertion Sort
Merge Sort
Selection Sort

(b) What is radix sort? Explain the algorithm for radix sort. (10+10)

Disclaimer: Well this looks a little stupid but we are not responsible if any portion of this paper
is not relevant with today’s syllabus. Due care has been taken to make this paper error free, but
there always remains a chance of error so please ignore any typographical error if present..

S-ar putea să vă placă și