We just started discussing stacks and queues in my class, and our teacher left us with some questions to answer. I got all of it done except for the last question, which I honestly just can't understand, and am wondering if there is something about stacks that I'm missing. Here is the question:
"Suppose you have aStack and Bstack. Assuming each stack starts empty, write the code that would write out the number of elements on aStack ultimately leaving aStack unchanged (without using a method involving a size variable)"
I don't really understand it because first and foremost, if I'm assuming the stack is empty, how can I write out the number of elements (unless I'm supposed to just write out the code regardless of what's actually inside the stack, at which point I'm not sure why it says the stacks are empty). Also, why would "bStack" be brought in? It doesn't seem like I'd need to utilize two stacks for this question.
Any help would be GREATLY appreciated!