Question #235852

Execute this code with THREE pushes and ONE pop:
stack<int> s;
s.push(1);
s.push(2);
s.push(3);
s.pop( );
Suppose that s is represented by a partially filled array. Draw the state of the private
member variables of s after the above code:
_______ __________________________________
used| | data| | | | | |
|_______| |______|______|______|______|______|
[0] [1] [2] [3] [4]

Expert's answer

manyelements is equal to 2 and the data array is as shown in the diagram.
manyelements                     data
           _______        __________________________________
         |       |       |      |      |      |      |      |
         1       2    3    [0]   [1]    [2]    [3]    [4]    [5]          


_____|______|______|______|____
                            

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS