Time Left - 10:00 mins

GATE CS 2018 - Data Structures Quiz 4

Attempt now to get your rank among 875 students!

Question 1

Given that the preorder traversal of binary tree is (1,2,3). Find the number of different binary trees are possible whose postorder traversal is (3,2,1) for the given preorder traversal?

Question 2

Level order traversal of a rooted tree can be done by starting from the root and performing

Question 3

The minimum size that an array may require storing in a complete binary tree with ‘n’ nodes is ___________.

Question 4

The height of a tree is defined as the number of edges on the longest path in the tree. The function shown in the pseudocode below is invoked as height(root) to compute the height of a binary tree rooted at the tree pointer root.
int height (treeptr n)
{ if (n == NULL) return -1;
if (n left == NULL)
if (n right == NULL) return 0;
else return [B1] ; // Box 1
else { h1 = height (n left);
if (n right == NULL) return (1 + h1);
else { h2 = height (n right) ;
return [B2] ; // Box 2
}
}
}
The appropriate expressions for the two boxes B1 and B2 are

Question 5

The number of leaf nodes in a rooted tree of n nodes, with each node having 0 or 3 children is:
  • 875 attempts
  • 3 upvotes
  • 20 comments
Mar 25GATE & PSU CS