Design a data representation mapping a stack
Sand a queueQinto a single arrayM. Write algorithms to add and delete elements from these two data objects.
To make it clear yes is homework!
I’m not asking for an answer I just need a link or something that can guide me to the answer, or if you can give me and example where it can be applied I am new in this and not very good as you can see.
This pretty simple guide will show you the difference between a stack and a queue: http://blog.bakhshi.eu/2005/11/stack-vs-queue.html
Essentially, the data for both a stack and a queue can be stored in an array. The difference is where you choose to take a new element out from. For a stack, the next element you take out (‘pop’) is the last one you put in. For a queue, the next element you take out is the first one you put in.
One approach would be to create a class which has a member variable of an array, and then has some methods: