1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vitfil [10]
3 years ago
5

Consider the following Stack operations:

Computers and Technology
1 answer:
maxonik [38]3 years ago
6 0

Answer:

Sequence of popped values: h,s,f.

State of stack (from top to bottom): m, d

Explanation:

Assuming that stack is  initially empty. Suppose that p contains the popped values. The state of the stack is where the top and bottom are pointing to in the stack. The top of the stack is that end of the stack where the new value is entered and existing values is removed. The sequence works as following:

push(d) -> enters d to the Stack

Stack:  

d ->top

push(h) -> enters h to the Stack

Stack:

h ->top

d ->bottom

pop() -> removes h from the Stack:

Stack:

d ->top

p: Suppose p contains popped values so first popped value entered to p is h

p = h

push(f) -> enters f to the Stack

Stack:

f ->top

d ->bottom

push(s) -> enters s to the Stack

Stack:

s ->top

f

d ->bottom

pop() -> removes s from the Stack:

Stack:

f ->top

d -> bottom

p = h, s

pop() -> removes f from the Stack:

Stack:

d ->top

p = h, s, f

push(m) -> enters m to the Stack:

Stack:

m ->top

d ->bottom

So looking at p the sequence of popped values is:

h, s, f

the final state of the stack:

m, d

end that is the top of the stack:

m

You might be interested in
Questic
N76 [4]

Answer:

Temporary Data

Explanation:

6 0
2 years ago
All of the language commands that the CPU understand make up the CPU's
disa [49]
I think assembly level command mov ,push ,call
5 0
3 years ago
What is the FICO system?
Serhud [2]
It is C) A credit investment system.
8 0
3 years ago
What is an allocation unit?
sdas [7]
It is a unit of disk space allocation for files and directories. Hope this helps :) 
5 0
3 years ago
________is one of the most popular payment gateways founded in in December 1998​
iren2701 [21]

paypel is the most popular

6 0
2 years ago
Other questions:
  • Tammy is preparing to give a presentation. she would like to view information that will remind her what to say to her audience b
    10·1 answer
  • Drag each label to the correct location on the image List the do’s and don’ts of safeguarding your password.
    14·1 answer
  • Please help I really need it
    7·1 answer
  • Who initially developed what is now known as the internet?
    5·1 answer
  • PLEASE HELP!!!!!!!!!!! The Excel tool that extends the height of a selected cell so that all the text fits into the cell and is
    10·2 answers
  • Fill in the blanks : To store 3 character a computer occupies...................bytes memory space​
    8·2 answers
  • ¿porque y como surge la informatica y las computadoras
    13·1 answer
  • Lol fortnite really going UwU and anime
    12·2 answers
  • Which of the following is NOT one of the three main ways to control a program when writing code?
    6·2 answers
  • The disk you inserted was not readable by this computer
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!