edited by
724 views
2 votes
2 votes

Consider the following statements:

$S_1$: If a STACK is implemented through a LINKED LIST, $\text{PUSH}$ operation will take $O\left ( 1 \right )$ time and $\text{POP}$ operation will take $O\left ( n \right )$ time.

$S_2$: If a QUEUE is implemented through an ARRAY, $\text{ENQUEUE}$ operation will take $\Theta \left ( \log n \right )$ time and $\text{DEQUEUE}$ operation will take $O\left ( 1 \right )$ time.


Which of the above statements is/are TRUE?

  1. Only $S_1$ is correct.
  2. Only $S_2$ is correct.
  3. Neither $S_1$ nor $S_2$ is correct.
  4. Both $S_1$ and $S_2$ are correct.
edited by

1 Answer

Best answer
3 votes
3 votes
if the stack is implemented with a linked list structure then push and pop both take $O$$\left ( 1 \right )$ time.

If the Queue is implemented with an array then Enqueue and Dequeue both take $O$$\left ( 1 \right )$ time

option $C$
selected by
Answer:

Related questions