Alternatively, copy one stack to another using the assignment operator (you need to overload it though!!) 24 Comparing stack implementations Big-O Comparison of Stack Operations Big-O Comparison of Stack Operations Big-O Comparison of Stack Operations Operation Array Implementation Linked Implementation Class constructor O(1) O(1) MakeEmpty O(1) O(N) IsFull O(1) O(1) IsEmpty O(1) O(1) Push O(1) O(1) Pop O(1) O(1) Destructor O(1) O(N) 25 Implementing queues using arrays
Simple implementation
The size of the queue must be determined when a stack object is declared
Space is wasted if we use less elements
We cannot "enqueue" more elements than the array can hold
26 Implementing queues using linked lists
Allocate memory for each new element dynamically
Link the queue elements together
Use two pointers, qFront and qRear, to mark the front and rear of the queue
27 Queue class specification
// forward declaration of NodeType (like function prototype)
PowerShow.com is a leading presentation sharing website. It has millions of presentations already uploaded and available with 1,000s more being uploaded by its users every day. Whatever your area of interest, here you’ll be able to find and view presentations you’ll love and possibly download. And, best of all, it is completely free and easy to use.
You might even have a presentation you’d like to share with others. If so, just upload it to PowerShow.com. We’ll convert it to an HTML5 slideshow that includes all the media types you’ve already added: audio, video, music, pictures, animations and transition effects. Then you can share it with your target audience as well as PowerShow.com’s millions of monthly visitors. And, again, it’s all free.
About the Developers
PowerShow.com is brought to you by CrystalGraphics, the award-winning developer and market-leading publisher of rich-media enhancement products for presentations. Our product offerings include millions of PowerPoint templates, diagrams, animated 3D characters and more.