Answer to Question #176065 in Software Engineering for Sarah

Question #176065

1Suppose you have an empty generic stack. What does the stack look like after the following operations have been performed? Be sure to indicate the top of the stack.

           

           Push 4

           Push 9

           Push 1

           Push 9

           Pop

           Push 8

           Pop

           Pop

           Push 3




1
Expert's answer
2021-03-31T11:30:39-0400

 

                Stack pointer                                    stack

                 SP                                                     bottom

                  |                                                          |

Push 4      4 |                                                          |

Push 9      9 4 |                                                       |

Push 1      1  9  4 |                                                  |

Push 9      9 1 9 4 |                                               |

Pop           1 9 4 |                                                    |

Push 8      8 1 9 4 |                                                |

Pop           1 9 4 |                                                   |

Pop            9 4 |                                                      |

Push 3       3 9 4                                                     |

 


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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS