Consider the following statements: i. First-in-first out types of computations…
1996
Consider the following statements:
i. First-in-first out types of computations are efficiently supported by STACKS.
ii. Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all the basic LIST operations.
iii. Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two indices.
iv. Last-in-first-out type of computations are efficiently supported by QUEUES.
Which of the following is correct?
- A.
(ii) is true
- B.
(i) and (ii) are true
- C.
(iii) is true
- D.
(ii) and (iv) are true
Attempted by 75 students.
Show answer & explanation
Correct answer: C
Let's break down and analyze each statement individually:
Statement i: First-in-first-out types of computations are efficiently supported by STACKS.
False. Stacks operate on a Last-In, First-Out (LIFO) mechanism. It is Queues that natively support First-In, First-Out (FIFO) computations.
Statement ii: Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all the basic LIST operations.
False. Linked lists are highly efficient for operations like insertion and deletion at known positions (O(1)). However, they require sequential traversal (O(n)) to search or access elements by index. Arrays, on the other hand, provide direct, constant-time random access (O(1)) to any element via an index. Therefore, linked lists are not more efficient for almost all basic operations.
Statement iii: Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two indices.
True. In a standard linear array implementation of a queue with two pointers (
frontandrear), deleting elements causes thefrontpointer to move forward. This permanently leaves the spaces at the beginning of the array completely unusable unless you shift all remaining elements backward—which is an expensive O(n) operation. A Circular Array solves this structural limitation by wrapping the pointers back around to index 0 using modulo arithmetic. This allows memory cells to be reused instantly without moving elements, keeping both insertion and deletion at a highly efficient O(1) time complexity without wasting memory.
Statement iv: Last-in-first-out type of computations are efficiently supported by QUEUES.
False. Queues inherently follow a First-In, First-Out (FIFO) workflow. Last-In, First-Out (LIFO) pipelines are supported by Stacks.
Since only statement (iii) is true, the correct choice is C.