question bank ds

3

Click here to load reader

Upload: sweetmaina

Post on 01-Dec-2015

24 views

Category:

Documents


1 download

DESCRIPTION

DS

TRANSCRIPT

Page 1: Question Bank DS

Course Instructor: Shipra Shukla

Question Bank

Data Structure Using C

B.Tech First Year (C.S.E.,M.E.)

Que 1. Here is a small binary tree:

14

/ \

2 11

/ \ / \

1 3 10 30

/ /

7 40

Write the order of the nodes visited in:

A. An in-order traversal:

B. A pre-order traversal:

C. A post-order traversal:

Que 2. What is the minimum number of nodes in a full binary tree with depth 3?

A. 3 B. 4 C. 8 D. 11 E. 15

Que 3. Discuss the following algorithms with example?

a) Selection sorting

b) Bubble sorting

c) Insertion sorting

Que 4. Consider s as a source vertex and trace the breadth first search (BFS) traversal in the following undirected

graph.

Que 5. What do you mean by searching technique? Explain binary search technique with algorithm?

Que 6. Write a C program to demonstrate the operations i.e. push (), pop (), traverse () on stack using switch

statement.

Que 7. Write a C program to sort an array.

Que 8. Given an array A[6][6] whose base address is 100.Calculate the location A[2][5]if each element occupies 4

bytes and array is stored row wise.

Que 9. Write a C program to insert an element in an unsorted array at given position.

Que 10. What is a stack and why stack is called LIFO data structure? Explain significance of top of the stack?

Que 11. Write the algorithm of infix to postfix and infix to prefix notations?

Page 2: Question Bank DS

Que 12. Write the algorithm to evaluate postfix expression and prefix expression?

Que 13. Convert into postfix form showing stack status after every step in tabular form:

1. A/(B^C)-D

2. (A-(B/C))*((D*E))-F)

3. (A*B+(C/D))-F

4. 8+5*4-12/6

5. [a+(b-c)]*[(d-e)/(f+g-h)]

Que 14. Convert into postfix form showing stack status after every step in tabular form:

1. A+(B*C-(D/E-F)*G)*H

2. A-B/(C^D)+(E*F)

3. A*(b+c)+(b/d)*a+z*u

4. a+((b+c)*(d+e)+f//g)

5. a+(b+c*d+e)+f/g

6. [a+(b-c)]*[(d-e)/(f+g-h)]

Que 15. Consider the following arithmetic expression in postfix notation:

7 5 2 + *4 1 5- / -

a) Find the value of the above expression.

b) Find the equivalent prefix of the above expression.

c) Find the value of the above expression from its prefix notation.

Que 16. Define B-Tree? Insert the following keys in a B tree of order 5

A,C,G,N,H,E,K,Q,M,F,W,L,T,Z,D,P,R,X,Y,S

Que 17. What is a Graph? Explain different types of graph?

Que 18. What do you mean by path matrix? Consider the following graph and show its path matrix.

Que 19. Let L= {71, 17, 86, 100, 54, 27} be an unordered list of elements. Show each pass of selection sort.

Que 20. Let L= {12 ,21, 34,38,45,49,67,69,78,79,87,93,97,99} be an ordered list of elements. Search for the key

k=21 and Show each pass of binary search.

Que 21. Define Warshall’s algorithm in detail and implement Warshall’s algorithm in the following graph.

Page 3: Question Bank DS

Que 22. Define binary search tree?

Que 23. What do you understand by balance factor in an AVL tree? Discuss properties of AVL tree.

Que 24. Insert the following elements in an AVL tree

3,2,1,4,5,6,7,16,15,14

Que 25. Differentiate B tree and B+ tree with examples and also discuss properties of a B tree?

Que 26. Write Depth first search algorithm?

Que 27. What do you mean by doubly linked list? Discuss insertion, deletion and display functions of doubly linked

list in detail?

Que 28. Draw a binary search tree by inserting the following no.s?

11,6,8,19,4,10,5,17,43,49,31

Que 29. What do you understand by divide and conquer technique? Illustrate the example of this technique in

detail?

Que 30. Explain Breadth first search algorithm with example?

Que 31. Differentiate between full and complete binary tree with examples?

Que 32. Explain methods of graph representation with examples?

Que 33. Write algorithms

a) Insertion at beginning in a queue

b) Deletion in a circular linked list

c) Insertion in a circular queue

d) Deletion in a circular queue

e) Insertion in a doubly linked list

f) Deletion in a doubly linked list

g) Insertion in a circular linked list

Que 34. Insert elements in a circular queue.

39,103,69,21,71.

Que 35. Define quick sort algorithm and sort the following elements of an array using quick sort.

5,3,21,9,1,13,2,7,10,12,4,8