United International University: Department of Computer Science and Engineering
United International University: Department of Computer Science and Engineering
Answer all the 6 questions. Numbers to the right of the questions denote their marks.
1. Use mathematical induction to prove the following summation formula for all positive integer values of n: [4]
n(n + 1)(2n + 1)
12 + 22 + 32 + 42 + · · · + n2 =
6
2. (a) Suppose a binary search tree has only 4 vertices who have no children. Find out the total number of vertices
of the tree. [1]
(b) Observe these 7 letters from the English alphabet, ’A’, ’C’, ’E’, ’H’, ’I’, ’S’, ’T’. Considering the dictionary
order, construct a Binary Search Tree from the letters. [2.5]
(c) Find out the number of edges and height of the tree you constructed in Question 2(b). Based on the height,
what is the maximum limit of the number of leaves in such a tree? [1.5]
(d) Is the tree you constructed in Question 2(b) a balanced tree? Explain with proper reasoning. [1]
3. (a) Show the order of vertices generated by inorder traversal of the ordered tree in Figure 1. [1]
(b) Show that postorder traversals of both ordered rooted trees in Figure 2 produce the same list of vertices. [2]
(c) Represent the expression ((y + 2) ↑ 3) ∗ (x − (y + 3)) − 8 using a binary tree. Write this expression in Prefix
notation. [2]
(d) Evaluate the following postfix expression : 9 3/5 + 7 2 − ∗ [1]
4. (a) In a road network graph, vertices represent intersections and edges represent roads. If we want to model both
one-way and two-way roads, and there is at most one road connecting two intersections, what kind of graph
that will be? State your reasoning. [2]
(b) Suppose, you have been told to draw an undirected graph of 5 vertices with some constraints. The graph
must contain at least one vertex of odd-degree, and at least one of even-degree. The odd-degree vertices must
have degree 3, and the even-degree vertices must have degree 4. What are the possible number of edges of the
graph? [3]
(c) Find out if the graph in Figure 3 is bipartite or not, using two coloring algorithm. If bipartite, show the graph
in bipartite form. [3]
(b) Find out if Graph 1 and Graph 2 in Figure 5 are isomorphic or not. [2]
6. (a) If a librarian picks 5 Calculus books from 7 different Calculus books and 4 different Discrete Math books from
6 different Discrete Math books, how many ways he can arrange these 9 books on a shelf such that a Calculus
book is at the beginning and a Discrete Math book is in the middle? [Note: each of the Calculus or Discrete
Math books is written by different writers] [3]
(b) From 6 CS faculty and 4 EE faculty, a committee of 6 is to be formed. In how many ways can this be done if
the committee contains (i) exactly 2 EE faculty, or (ii) at least 2 EE faculty? [2]
(c) If a student writes random strings of length 3 using the vowels (A,E,I,O,U) only, how many times he is required
to write such strings to be sure that he has written a string twice? [3]