a) Once
b) Twice
c) Thrice
d) Four times
Answer: d
Explanation: First each element from the first stack is popped, then pushed into the second stack, dequeue operation is done on the top of the stack and later the each element of second stack is popped then pushed into the first stack. Therfore each element is touched four times.
Related Posts
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf(“%d “, head->data);
}Which of the following points is/are not true about Linked List data structure when it is compared with an array?
Linked list data structure offers considerable saving in _____________
In Linked List implementation, a node carries information regarding ___________
Linked list is considered as an example of ___________ type of memory allocation.
Linked lists are not suitable for the implementation of ___________
Join The Discussion