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




Expert's answer

 

                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!

LATEST TUTORIALS
APPROVED BY CLIENTS