📜  门|门 CS 1996 |问题 12

📅  最后修改于: 2021-09-26 03:26:01             🧑  作者: Mango

考虑以下语句:

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.

以下哪个是正确的?

(A) (ii) 和 (iii) 是正确的
(B) (i) 和 (ii) 是正确的
(C) (iii) 和 (iv) 是正确的
(D) (ii) 和 (iv) 是正确的答案:(一)
说明: i -STACK 是遵循后进先出(LIFO)或先进后出(FILO)顺序的数据结构,其中最后插入的元素先被移除。

ii – 对于几乎所有基本的 LIST 操作,在链表上实现 LISTS 比在数组上实现它更有效,因为元素的插入和删除可以在链表中以 O(1) 完成,但需要 O(N) 时间数组。

iii- 在圆形数组上实现 QUEUES 比在具有两个索引的线性数组上实现它更有效,因为使用圆形数组,它占用的空间更少并且可以再次使用它。

iv – QUEUE 是遵循先进先出 (FIFO) 或后进后出 (LILO) 顺序的数据结构,其中先插入的元素首先被删除。

只有 (ii) 和 (iii) 是真实的。
选项(A)是正确的。
这个问题的测验