Please enable JavaScript.
Coggle requires JavaScript to display documents.
Stacks, Queues - Coggle Diagram
Stacks
-
Types of implementation
Array-based stacks
-
Comparison
All operations for the array-based and linked stack implementations take constant time, so from a time efficiency perspective, neither has a significant advantage
The array-based stack must declare a fixed-size array initially, and some of that space is wasted whenever the stack is not full. The linked stack can shrink and grow but requires the overhead of a link field for every element
-
Queues
-
Types of implementation
Array-based queues
The array-based queue is somewhat tricky to implement effectively. A simple conversion of the array-based list implementation is not efficient
Comparison
All member functions for both the array-based and linked queue implementations require constant time. The space comparison issues are the same as for the equivalent stack implementations. Unlike the array-based stack implementation, there is no convenient way to store two queues in the same array, unless items are always transferred directly from one queue to the other
-