본문 바로가기

[자료구조론] - Data Structure/[Concept]

Questions regarding Data Structures

Q. What is advantage of implementing stack and queue by arrays?

 

A. The advantage of using an array implementation for a stack is that it is more efficient in terms of time than a linked list implementation. This is because there is none of the work associated with claiming new store as the size of the stack increases and garbage collecting it as it reduces. Rather there is a fixed amount of store set aside from the start for the stack. As stacks are destructive we do not have to copy this store every time we perform a stack operation, and in general in the sort of applications where stacks are used we do not have large numbers of them, so there is not a big issue of waste of store.

A. Correctly implemented, an array-based stack or queue can be faster and more memory efficient than a linked list implementation.

'[자료구조론] - Data Structure > [Concept]' 카테고리의 다른 글

postOrder - LRC  (0) 2020.11.03
Tree 구현  (0) 2020.10.27
Dynamic Queue (Using LinkedList)  (0) 2020.10.19
Dynamic Stack (Using Linked List)  (0) 2020.10.19
DoubleLinkedList  (0) 2020.10.19