ROLAND INSTITUTE OF TECHNOLOGY, BERHAMPUR DATA STRUCTURE USING ‘C’,MCA 2nd sem ASSIGNMENT-II (2012-2013) The postfix form of the expression ABCDEF / G The data structure required to evaluate a postfix expression is What is the maximum possible number of nodes in a binary tree at level 6? The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is What is a Binary Search Tree (BST)? Make a BST for the following sequence of numbers. 45, 36, 76, 23, 89, 115, 98, 39, 41, 56, 69, 48. Traverse the tree in Preorder, Inorder and postorder. 6. What are expression trees? Represent the following expression using a tree. Comment on the result that you get when this tree is traversed in Preorder, Inorder and postorder. (a-b) / ((c*d)+e). 7. How do you rotate a Binary Tree? Explain right and left rotations with the help of an example. 8. Draw a B-tree of order 3 for the following sequence of keys: 2, 4, 9, 8, 7, 6, 3, 1, 5, 10 9. Convert the following infix expressions into its equivalent postfix expressions; 1. 2. 3. 4. 5. (i) A B D/EFG (ii) A*BD/ E-F*G H/K 10. Create a heap with following list of keys: 8, 20, 9, 4, 15, 10, 7, 22, 3, 12 11. Illustrate the steps for converting an infix expression into a postfix expression for the following expression a bc d/e f g . 12. Construct a binary tree whose nodes in inorder and preorder are given as follows: Inorder : 10, 15, 17, 18, 20, 25, 30, 35, 38, 40, 50 Preorder: 20, 15, 10, 18, 17, 30, 25, 40, 35, 38, 50 13. Execute your algorithm to convert an infix expression to a post fix expression with the following infix expression on your input mn*k p/g / ba b / c 14. Show the result of inserting the keys. F, S, Q, K, C, L, H, T, V, W, M, R, N , P, A, B, X, Y, D, Z, E in the order to an empty B-tree of degree-3. 15. Write a complete algorithm to create a single linked list. Write functions to do the following operations (i) Insert a new node at the end (ii) Delete the first node 16. Given the following inorder and preorder traversal reconstruct a binary tree Inorder sequence D, G, B, H, E, A, F, I, C Preorder sequence A, B, D, G, E, H, C, F, I 17. Make a BST for the following sequence of numbers. 45,32,90,34,68,72,15,24,30,66,11,50,10 Traverse the BST created in Preorder, Inorder and Postorder 18. What are B-trees? Draw a B-tree of order 3 for the following sequence of keys. 3,5,11,10,9,8,2,6,12 19. Write a procedure to reverse a singly linked list. 20. Execute your algorithm to convert an infix expression to a post fix expression with the following infix expression as input Q A B/C DE / F G H/ I 21. Write a procedure to insert a node into a linked list at a specific position and draw the same by taking any example? 22. Convert the following Infix expression to Postfix form using a stack: x + y * z + (p * q + r ) * s, Follow usual precedence rule and assume that the expression is legal. 23. Construct the binary tree for the following sequence of nodes in preorder and inorder respectively. Preorder : G, B, Q, A, C, K, F, P, D, E, R, H Inorder: Q, B, K, C, F, A, G, P, E, D, H, R 24. Convert the following infix expression into a postfix expression (Show steps) ABD/ E FG H/ k 25. What is a height balanced tree? Explain how the height is balanced after addition/deletion of nodes in it? 26. 27. Consider the following eight numbers 50, 33, 44, 22, 77, 35, 60 and 40. Display the construction of the binary by inserting the above numbers in the given order. 28. Define the following : (i) AVL tree. (ii) Heap. (iii) Binary Search Tree.