A nun in a orgy makes more sense than this.. A stack of what? integers? strings? Are we walking about std::stack? Using the stack of the actual processor architecture?
Does it really matter what it's a stack of? A stack, as an abstract data type, only have one operation to add elements, and that is at the top of the stack.
HelenI, normally if you have to add something at the bottom you probably shouldn't use a stack in the first place, but I guess you have been given this as a programming exercise so it can be done. Maybe it's easier if you think of something real. Put a stack of plates in front of you. Now the problem is to place another plate under all the other plates but you are only allowed to remove and add one plate at a time from the top of the stack. How would you do this?
> A stack, as an abstract data type, only have one operation to add elements, and that is at the top of the stack, and that is at the top of the stack.
A stack to my knowledge is a contiguous column of memory that has two operations, store and release numerous data types, each one added to the bottom.
To me it would matter what data type it is, as each primitive is of different byte length, an integer would have to decrease the SP by 4 while a char would only be decreased by one.
So yes, it ought to matter right? Not trying to troll or prove you wrong, but when he said push I immediately thought of the assembly instruction, and at that level the type of data would matter.
hello guys.....my code looks like this..... stack a includes letters, stack b includes a number and stack c includes the numbers 1 or 2. Now i have to check if z is not the same number with c.top() i have to push that item to the bottom.