Time Left - 10:00 mins

IIIT Hyderabad Practice Quiz : Data Structures-3

Attempt now to get your rank among 351 students!

Question 1

Consider the following statements :
S1 : A stack can be implemented using 2 queues where each push and pop operation takes O(n) time.
S2 : A stack can be implemented using 2 queues where among push and pop operation, atmost one operation takes O(n) time and other takes O(1) time.
S3 : A queue can be implemented using 2 stacks where each enqueue and dequeue operation takes O(n) time.
S4 : A queue can be implemented using 2 stacks where among enqueue and dequeue operation, atmost one operation takes O(n) time and other takes O(1) time.
Which of the above statements are true :

Question 2

The number of stack required to implement queue will be (by using basic stack operation push and pop):

Question 3

Let q be a queue and S be a stack. Assume that q and S are initially empty. What is the last integer value printed by the following code?
Enqueue (q,8);
enqueue (q,3);
Push (S,7);
Push (S,9);
for
{
printf ;
printf ;
enqueue (q,i);
Push
}

Question 4

Consider generating Binary Search trees using a given set of numbers in the following order. Which of the following sequence of numbers will result in a tree that is strictly binary tree, i.e., every node has either two children or no children?

Question 5

In delete operation of binary search tree, we need inorder successor (or predecessor) of a node when a node to be deleted where it has both left and right child. Which of the following is true about inorder successor needed in delete operation?
  • 351 attempts
  • 1 upvote
  • 0 comments
Mar 1GATE & PSU CS