


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
CSD 201 ENDSEMS 2017, High chance of question getting repeated or getting the similar type of questions, C language.
Typology: Exercises
1 / 4
This page cannot be seen from the preview
Don't miss anything!
Programme: B.Tech Discipline: Computer Science and Engineering Exam : End Semester Year: 2016- Course Code: CSD201 Course Title: Data Structures Date: May 02, 2017 Time: 9:30 AM - 12.30 PM Max. Marks: 90
Ques1. Write True or False against each of the following: (5 Marks)
will still be a shortest s-t path in (V, E, w').
Ques2. What is the result of relaxing the following edges as per Bellman Ford Algorithm: (3 Marks)
(i)
(ii)
(iii)
Ques3. Draw a hash table with open addressing (Linear Probing) with a table size of 9. Use the hash function “k % 9”. Insert the keys: 5, 29, 20, 0, 27 and 18 into your table (in that order). (2 Marks)
Ques4. Fill in the blanks: (7 Marks)
Ques5. Write down the space and time complexities of Kruskal’s Algorithm. (2 Marks) Ques6. What is the Red constraint in a Red-Black Tree? (1 Mark)
Ques7. Convert the expression ((X + Y) * Z - (P - Q) ^ (R + S)) to equivalent postfix notation. (2 Marks) Ques8. Write down the equation that define the relationship between the parent and child nodes in a ternary tree (degree 3 tree) when using array representation with all array elements representing valid nodes notation, with no gaps for full or complete trees. (2 Marks)
Ques9. Draw the B-Tree of order 3 created by inserting the following data arriving in sequence: 92, 24, 6, 7, 11, 8, 22, 4, 5, 16, 19, 20, 78 (5 Marks)
Ques10. (a) Show the red-black tree that results after each of the integer keys 9, 8, 7, 3, 5 and 2 are inserted, in that order, into an initially empty red-black tree. Clearly show the tree that results after each insertion (indicating the color of each node), and make clear any rotations that must be performed.
(b) Delete 2, 5, 3, 7, 8, 9 in that order from the above tree. (10 Marks)
Ques11. State the order in which the vertices of the below given graph will be traversed when the edges incident on a vertex are traversed by the alphabetic order of the adjacent vertices, and each of the following traversal algorithms is used. Start at node A. (2 Marks)
Depth First Traversal : _______________________________ Breadth First Traversal : _____________________________
Ques12. Consider the following algorithm: (5 Marks) for (i = 1 to 100) { for( k = 1 to n) { j = 1; m = n; while(j < m) { m = (m = j) / 2; }
} } for (i = 1 to 3) { for (j = 1 to n) { k = i + j + n; } } for (i = 1 to 70) { j = 2n + i; }
(a) What is its exact running time with respect to n? (b) What is its big O running time? (c) What is its big Omega running time? (d) What is its big Theta running time?
Ques17. Draw the Binary Search Tree from the given Inorder and Postorder Traversals. ( 3 Marks) Inorder: D, A, H, E, J, F, I, B, G, C Postorder: A, D, E, H, F, B, C, G, I, J
Ques18. Consider this Binary Search Tree: (1 Mark)
Suppose we remove the root, replacing it with something from the left subtree. What will be the new root?
Ques19. Consider the following AVL Tree and perform the instructions given below: (5 Marks)
Consider the original tree for performing every operation and draw the Resultant Tree after every operation.
Ques20. Given the following node structure and field definition for a general tree. The data in each element also contains a pointer to a child node in the tree. (10 Marks)
*typedef struct node { int data; struct node child; }NODE;
Use pseudocode to complete the following function to determine the height of a subtree of a general tree where the root node of the subtree contains the given data value. You may use any data structures and their operations that we have discussed in class.
int heightSubtree(NODE root, int data) return height ( search ( root, data ) ) end heightSubtree
A. Complete the algorithm for search. You may not assume an enumerator exists.
NODE search ( NODE tree, int data )
B. Complete the algorithm for height. You may not assume an enumerator exists. You must program the leaf check yourself.
int height ( NODE tree )
(i) Insert 32 (ii) Remove 50 (iii) Insert 38