Midterm Data Structure 23
Midterm Data Structure 23
How many stacks are needed to implement a queue. Consider the situation 1/1
where no other data structure like arrays, linked list is available
to you.
How many queues are needed to implement a stack. Consider the situation 1/1
where no other data structure like arrays, linked list is available to you.
4
A priority queue can efficiently implemented using which of the following 1/1
data structures? Assume that the number of insert and peek (operation to
see the current highest priority item) and extraction (remove the highest
priority item) operations are almost same.
Array
Linked List
Which of the following is true about linked list implementation of queue? 1/1
In push operation, if new nodes are inserted at the beginning of linked list, then in
pop operation, nodes must be removed from end.
In push operation, if new nodes are inserted at the end, then in pop operation,
nodes must be removed from the beginning.
Enqueue
Back
Dequeue
None of them
Suppose a stack implementation supports an instruction REVERSE, which 1/1
reverses the order of elements on the stack, in addition to the PUSH and
POP instructions. Which one of the following statements is TRUE with
respect to this modified stack?
A queue can be implemented where both ENQUEUE and DEQUEUE take a single
instruction each.
A queue is implemented using an array such that ENQUEUE and DEQUEUE 1/1
operations are performed efficiently. Which one of the following
statements is CORRECT (n refers to the number of items in the queue)?
At most one operation can be performed in O(1) time but the worst case time for
the other operation will be Ω(n)
The worst case time complexity for both operations will be Ω(n)
Level of a node is distance from root to that node. For example, level of 1/1
root is 1 and levels of left and right children of root is 2. The maximum
number of nodes on level i of a binary tree is
2^(i-1)
2^I
2^(i+1)
2^[(i+1)/2]
The maximum number of binary trees that can be formed with three 1/1
unlabelled nodes is:
Postorder traversal of a given binary search tree, T produces the following 1/1
sequence of keys 10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29
Which one of the following sequences of keys can be the result of an in-
order traversal of the tree T?
9, 10, 15, 22, 23, 25, 27, 29, 40, 50, 60, 95
9, 10, 15, 22, 40, 50, 60, 95, 23, 25, 27, 29
29, 15, 9, 10, 25, 22, 23, 27, 40, 60, 50, 95
95, 50, 60, 40, 27, 23, 22, 25, 10, 9, 15, 29
Consider a node X in a Binary Tree. Given that X has two children, let Y be 1/1
Inorder successor of X. Which of the following is true about Y?
63 and 6, respectively
64 and 5, respectively
32 and 6, respectively
31 and 5, respectively
Which of the following number of nodes can form a full binary tree? 1/1
15
14
13
True
False
Linked lists are the best data structure in case the size and structure of the 1/1
data are constantly changing.
True
False
Any Node in the path from the root of a tree data structure to the 1/1
destination node is called ---------- node.
Descendant
Sibling
Ancestor
True
False
What does the following function do for a given Linked List with first node 1/1
as head?
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy
Forms