The following is a sequence of stack operationsS1.push (12);S1.push (-5);Int t1 = S1.pop();S1.push (-8);S1.push (20);Int t2 = S1.topValue();S1.pop ();S1.push (4);I. Assuming all instructions execute in the given sequence, draw four diagrams,showing the contents of the stack, after executing the second, fourth, sixth,and eighth instructions. In each diagram, include the values of all elements inthe stack, and a pointer denoting the current "top" of the stack.II. What are the values of t1 and t2 after the code executes?
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here