data structures and algorithms question bank

Upload: ramkrishnamurti

Post on 13-Oct-2015

423 views

Category:

Documents


28 download

DESCRIPTION

Multiple Choice Questions on Data Structures and Algorithm

TRANSCRIPT

Data Structures and Algorithms Question Bank

UNIT I PART - A

1. What do you meant by data structure?

2. List out the areas in which data structures are applied extensively.

3. Define algorithm.4. Define program.5. What is a pointer?

6. Define self-referential structure.7. What are the different types of data structure?8. Define linear data structure and Give some examples.9. What is meant by an abstract data type?

10. What are the operations of ADT?

11. Difference between array and list.

12. What is an ordered list?

13. What is meant by list ADT?

14. What are the various operations done under list ADT?

15. What are the different ways to implement list?

16. What are the advantages in the array implementation of list?

17. What are the disadvantages of array implementation of List?

18. How do you overcome the difficulties of array implementation of list?

19. What is a dummy header and why do we use it?

20. What is a linked list? Give one example.

21. List the advantages and disadvantages of Linked List.

22. What do you mean by circular linked list? Give an example.

23. Discuss the use of circular linked list

24. What is the problem in using circular linked list? How can you overcome it?

25. What is a doubly linked list or two-way chain?

26. Define double circularly linked list?

27. Why do we use doubly linked list? State the advantages of doubly linked list

over singly linked list.

28. What is cursor implementation of linked list?

29. List the applications of Linked List.

30. What is a stack?

31. What are the various operations performed on the stack?

32. Is it possible to have more than one stack in an array.

33. What is meant by overflow and underflow condition in a stack?

34. Name any two applications of stack?

35. Define Queues.

36. What are the various operations performed on the Queue?

37. How do you test for an empty queue?

38. List the applications of queue.

39. Write down the operations that can be done with queue data structure?

40. What is a circular queue?

41. What is a circular queue? How it differs from linear queue?

42. What are the limitations of circular array implementation of queue?

43. Define input restricted queue.

44. Define output restricted queue.

45. Define and List the types of Dequeue.

46. List the applications of Queues.

PART B

1. Discuss the array representation of list with algorithm and example.

2. What is a singly linked list? Show how insertion, deletion and searching into a singly linked list could be carried out.

3. Explain and write the algorithms for creation, insertion, deletion, searching and updation in doubly linked lists using pointers.

4. Explain and write the algorithms for creation, insertion, deletion and searching in Circular Linked List.

5. Given a list L1, delete all the nodes having even number in info part from the list L1 and insert info list L2 and all the nodes having odd numbers into list L3. Write the algorithm.

6. Given two sorted linked lists, merge them into a third sorted linked list, if an element is present in both the list, it should occur only once in the third list. Write the algorithm.

7. Write ADT operations for array implementation of polynomial addition.

8. Write the algorithm to multiply two polynomials. Discuss with examples.

9. Discuss the concept of cursor and array implementation of LIST with example.

10. What is the stack ADT? Give any one array implementation of stack. Explain the operations used in the data structure.

11. Explain how the following infix expression is evaluated with the help of Stack 5 * ( 6 + 2 ) 12 / 4.

12. Explain the procedure and routines to evaluate the postfix expression using stack with example.

13. Explain the procedure to check the parentheses balancing in a given expression using stack.

14. Discuss any two applications of stack along with its implementations.

15. How a queue does works? Explain the algorithm to insert and delete an element in a queue.

16. Write ADT operations for circular queue with suitable example.

17. Describe the structure of a circular queue and its advantages over linear queues.

18. Write insertion and deletion algorithm for various types of dequeue.

UNIT II PART - A1. Define non-linear data structure.

2. Define tree.

3. List out few of the application of tree data structure.

4. Define leaf.

5. What is level of node?

6. Define degree of a node.

7. Define siblings.

8. Define level and height.

9. What is the length of the path in a tree?

10. Define forest.

11. What is a ordered tree?

12. What is subtree?

13. Define Binary tree.

14. State the properties of binary tree.

15. What are the applications of binary tree?

16. What is meant by traversing?

17. What are the different types of traversals?

18. What are the two methods of binary tree implementation?

19. What are the various operation of binary trees that use linked representation?

20. Define pre-order traversal?

21. Define post-order traversal?

22. Define in -order traversal?

23. Define Complete Binary Tree?

24. What is Threaded Binary Tree?

25. Show that the maximum number of nodes in a binary tree of height h is 2h+1-1.

26. Define expression trees?

27. Define Binary Search Tree?

28. List out the steps involved in deleting a node from a binary search tree.

29. List the applications of Trees.

30. Define AVL Tree.

31. What is a balance factor in AVL trees?

32. What is meant by pivot node?

33. What are the different ways of balancing a tree?

34. What are the four different cases of pointer manipulations done in AVL rotation?

35. Define Binary Heap

36. What is a complete binary tree?

37. What is the structure property of a binary heap?

38. What are the basic operations of binary heap?

39. What is meant by percolate-down?

40. What is meant by percolate-up?

PART - B

1. Define binary search tree? Explain the various operations with an example?

2. Explain the recursive algorithm for tree traversals with examples.

3. Explain the non-recursive algorithm for tree traversals with examples.

4. Discuss the constructing an expression tree with suitable example.

5. Construct a binary tree to satisfy the following orders:

Inorder: D B F E A G C L J H K

Postorder: D F E B G L J K H C A

6. Consider the following binary tree:

G

/ \

D T

/

/ \

B

M X

/ \ / \ \

A C I K Y

\

P

(a) What is the result of a postorder traversal of the above tree?

(b) What is the result of an inorder traversal of the above tree?

(c) Is the above tree a binary search tree? Why or why not?

7. Define a binary search tree (BST).Write an algorithm to find, insert and delete nodes from a binary search tree.

8. Write down the algorithm binary search for searching x from an array a[1,n] and give the stepwise execution for an array (10,12,20,23,27,30,31,39,42,

44,45,49,57,63,70) to search x=44.

9. Construct a binary search tree for the following set of numbers and find the preorder,inorder and postorder traversal of the tree {1,8,11,32,23,4,3,5,9,11,12,

41,63,44,17}.

10. Draw a binary search tree for the following input list {60,25,75,15,50,66,33,44}. Trace the algorithm to delete the nodes {25,75,44} from the tree.

11. Define AVL trees? Explain the LL, RR, RL, LR cases with an example?

12. Write routines for ADT operation of AVL tree.

13. Explain with suitable examples the binary heap operations and algorithms for the same.

UNIT III PART - A1. What is hashing?

2. What is need for hashing?

3. Define hash function?

4. Define hash table.

5. What is meant by preconditioning?

6. Classify the hashing functions based on the various methods by which the key value is found.

7. Give a simple hash function when the input keys are integers.

8. What is meant by collision?

9. Give an example for collision.

10. What are the problems in hashing?

11. What are the types of collision resolution techniques and the methods used in each of the type?

12. What is open hashing or separate chaining?

13. What is closed hashing?

14. What is meant by load factor in hashing?

15. What are the three strategies used in open addressing?

16. Define linear probing.

17. Define quadratic probing.

18. What is meant by primary clustering in linear probing technique?

19. What is the remedy for primary clustering problem?

20. What are the drawbacks in linear probing?

21. Define double hashing.

22. What is the need for rehashing?

23. When is the rehashing used?

24. List the condition in which rehashing is done.

25. What is meant by extendible hashing?

26. What are the applications of hashing?

27. Define equivalence relation and its properties.

28. Define dynamic equivalence problem.

29. What is equivalence class?

30. What is meant by union-by-size approach?

31. What is meant by union-by-height approach?

32. Explain the path compression.

PART - B

1. What are the various hashing techniques? Give suitable examples.

2. What is meant by collision resolution in hashing? Explain in detail any two strategy for dealing with it.

3. Derive a scheme that performs insertions and deletions in a hash table.

4. Write routines to find and insert an element in a separate chaining hash table.

5. How will you resolve the collisions, while inserting elements into the hash table using separate chaining and linear probing? Write the routines for inserting, searching and removing elements from the hash table using the above mentioned techniques.

6. Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(X)=X (mod 10), show the resulting:

(a) Separate chaining hash table

(b) Open addressing hash table using linear probing

(c) Open addressing hash table using quadratic probing

(d) Open addressing hash table with second hash function h2(X)=7-(X mod 7)

7. Explain the concept of extendible hashing with neat example.

8. Discuss concept and algorithm for smart union algorithms with neat diagram.

9. What would you observe from the path compression?

UNIT IV PART - A

1. Define the term Graph?

2. Define adjacent nodes.

3. List the two types of graphs.

4. What is a directed and undirected graph?

5. What is a directed and undirected edge?

6. What is a loop?

7. What is a simple graph?

8. What is a weighted graph?

9. What is an isolated node?

10. What is a null graph?

11. Explain the following terms i) degree, ii) indegree and iii) outdegree

12. Define total degree of a node.

13. Define path in a graph?

14. What is a simple path?

15. What is a cycle or a circuit?

16. What is an acyclic graph and does an acyclic graph have loops, why?

17. What is a sink node?

18. What is meant by strongly connected in a graph?

19. When is a graph said to be weakly connected?

20. What is a complete graph?

21. Name the different ways of representing a graph?

22. What is adjacency list and adjacency matrix?

23. What are the advantages of using lists for representing graphs?

24. What is topological sort?

25. Where is topological sort used?

26. Does a directed graph with cycle has a topological order.

27. Define weighted and unweighted path length.

28. What are the two traversal strategies used in traversing a graph?

29. What is a minimum spanning tree? Name any two algorithms used to find MST.

30. Does the minimum spanning tree of a graph give the shortest distance

between any 2 specified nodes.

31. Can we have a minimum spanning tree for a graph, if G is not connected?

32. What is the number of edges in a minimum spanning tree?

33. Give some applications of minimum spanning trees.

34. What is a single-source shortest path problem?

35. What is meant by shortest path?

36. What is all-pairs shortest path problem?

37. Write down the advantages of using all-pairs problem.

38. Give examples for shortest path problem.

39. Define Dijkstras greedy criterion.

40. What is the complexity of dijkstras algorithm?

41. What is an undirected acyclic graph?

42. What is a spanning tree?

43. Define prims algorithm.

44. What is the running time for prims algorithm?

45. Define DFS.

46. Define biconnected graph.

47. Define a biconnected component.

48. What is articulation point?

49. What is connected component of a graph?

50. Define Euler path.

51. Define Euler circuit.

52. Define a bipartite graph.

PART - B1. Explain the various types of Graph representations.

2. Explain the various types of Graph traversals with neat algorithms.

3. Explain the concept of Topological Sort algorithm with example.

4. Explain Dijkstra's algorithm finding shortest path in a network trace an algorithm for an assumed network.

5. Explain Dijkstras algorithm with an example. Does the algorithm work for paths of negative values? Explain.

6. Define spanning tree. Explain Prim's algorithm to find a minimal spanning tree in a connected graph with an example.

7. Describe and justify Kruskals algorithm for finding the minimum spanning tree of an undirected graph.

8. Write ADT routines for depth first search algorithm.

9. What is DFS? Explain the applications of DFS in detail.

10. Write a routine to find a shortest path between two given vertices in a weighted directed graph. Use it to find the shortest path between A and F in the following graph.5

4

3

2

6

7

3

5

11. Write a routine to find a minimum spanning tree of a weighted directed graph. Use it to find the MST of the following graph.

5

4

3

2

6

7

3

5

12. Find the shortest path from A to all other vertices for the graph in the following graph.

1

5

2

3

1

2

3

7

7

2

2

1

7

UNIT - V

PART - A

1. Define algorithm.

2. State properties of algorithms.

3. Define efficiency of an algorithm.

4. What is an asymptotic notation? Mention its types.

5. Define time complexity of an algorithm.

6. Define the asymptotic notation Big on (0).

7. Define the asymptotic notation Omega ( W ).

8. Define the asymptotic t\notation theta (q ).

9. Define Little oh.

10. Define Little Omega.11. Define worst case of an algorithm.

12. Define average case of an algorithm.

13. Define best case of an algorithm.

14. Mention the various spaces utilized by a program.

15. Define space complexity of an algorithm.

16. State the different memory spaces occupied by an algorithm.

17. Define instruction space of an algorithm.

18. Define environment space of an algorithm.

19. Define algorithmic paradigms space of an algorithm.

20. Explain divide and conquer technique.

21. Mention some of the problem that implements divide and conquer algorithm.

22. Give the recurrence relation of divide-and-conquer?23. What is greedy algorithm?

24. Mention some of the problems that implements greedy algorithm.

25. Define dynamic programming algorithm.

26. Mention some of the problems that implements dynamic programming algorithm.

27. Define brute force algorithm.

28. Mention some of the problems that implements brute force algorithm.

29. Define backtracking algorithm.

30. Mention some of the problems that implements backtracking algorithm,

31. Define longest common subsequence problem.

32. Define knapsack problem.

33. Define 8 queens problem.

34. Define traveling salesman problem.

35. Briefly explain graph coloring.

36. What is NP completeness?

37. What is the property of NP complete problem?

38. List the example for NP complete problems.

39. Define NP-hard.

40. What is meant by polynomial bounded?

41. When is a problem said to be polynomially bounded?

PART B

1. Discuss the fundamentals of analysis framework and notations used in algorithm design.

2. Discuss the various algorithm design strategies with examples.

3. Describe greedy method of solving problem. How can you apply it for optimal storage on tapes?

4. Explain the Knapsack problem in detail.

5. Explain the greedy strategy technique in the design of algorithm.

6. Explain divide and conquer algorithm with example.

7. What is dynamic programming? Discuss the examples of dynamic programming.

8. Explain the any one concept of randomized algorithm.

9. Discuss the method of solving any problem by back tracking. How is it applicable to 8 queens problem? Explain.

10. Explain subset-sum problem and discuss the possible solution strategies using backtracking.

11. Describe in detail the travelling salesman problem.

12. Discuss the solution for traveling salesman problem using branch and bound

technique.

BOOK DETAILS

S. NoTypeTitle of the BookAuthorPublication

1.Text BookData Structures and Algorithm Analysis in CM. A. WeissSecond Edition, Pearson Education, 1997

2.Reference BookProgramming with C++D.RavichandranTata McGraw Hill, New Delhi

Data Structures using CA. M. Tenenbaum

Y. Langsam

M. J. AugensteinPearson Education, 1998

Data StructuresR. F. Gilberg

B. A. ForouzanSecond Edition, Thomson India Edition, 2005

3.Knowledge BookData Structure using CISRD GroupTata McGraw Hill, New Delhi

4.Examination BookData Structures and Algorithm Analysis in CM. A. WeissSecond Edition, Pearson Education, 1997

DATA STRUCTURES AND ALGORITHMS

B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2010Third SemesterElectrical and Electronics EngineeringEE2204 DATA STRUCTURES AND ALGORITHMS

Answer ALL QuestionsPART A (10 2 = 20 Marks)1. List out the areas in which data structures are applied extensively.

2. Convert the expression ((A+B)*C-(D-E)^(F +G)) to equivalent Prefix and Post fix notations.3. How many different trees are possible with 10 nodes?

4. What is an almost complete binary tree?6. What is the bucket size, when the overlapping and collision occur at same time?7. Define graph.8. What is a minimum spanning tree?9. Define NP hard and NP complete.10. What is meant by dynamic programming?

PART B (5 16 = 80 Marks)

11. (a) (i) What is a linked list? Explain with suitable program segments any four operations of a linked list. (Marks 12) (ii) Explain with a pseudo code how a linear queue could be converted into a circular queue. (Marks 4) Or (b) (i) What is a stack ADT? Write in detail about any three applications of stack. (Marks 11) (ii) With a pseudo code explain how a node can inserted at a user specified position of a doubly linked list. (Marks 5)

12. (a) (i) Discuss the various representations of a binary tree in memory with suitable example. (Marks 8) (ii) What are the basic operations that can be performed on a binary tree? Explain each of them in detail with suitable example. (Marks 8) Or (b) (i) Give an algorithm to convert a general tree to binary tree. (Marks 8) (ii) With an example, explain the algorithms of in order and post order traversals on a binary search tree. (Marks 8)

13. (a) What is an AVL tree? Explain the rotations of an AVL tree. (Marks 16) Or (b) (i) Explain the binary heap in detail. (Marks 8) (ii) What is hashing? Explain any two methods to overcome collision problem of hashing. (Marks 8)

14. (a) (i) Explain Dijkstra's algorithm and solve the single source shortest path problem with an example. (Marks 12) (ii) Illustrate with an example, the linked list representation of graph.(Marks 4) Or (b) (i) Write the procedures to perform the BFS and DFS search of graph. (Marks 8) (ii) Explain Prim's algorithm to construct a minimum spanning tree from an undirected graph. (Marks 8)

15. (a) (i) With an example, explain how will you measure the efficiency of an algorithm. (Marks 8) (ii) Analyze the linear search algorithm with an example. (Marks 8) Or (b) Explain how the travelling salesman problem can be solved using greedy algorithm. (Marks 16)

B

D

A

C

E

F

B

D

A

C

E

F

B

G

A

D

E

F

C