Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  1. Let Q denote a queue containing sixteen numbers and S be an empty stack. Head (Q) returns the element at the head of the queue Q without removing it from Q. Similarly Top (S) returns the element at the top of S without removing it from S. Consider the algorithm given below.

    The maximum possible number of iterations of the while loop in the algorithm is _________.
    1. 156
    2. 128
    3. 256
    4. None of these
Correct Option: C

∵ n = 16
Therefore, maximum number of iterations will be n2 = 256



Your comments will be displayed only after manual approval.