1 / 42

Chapter 4: Stacks

In the last problem:Remainders are generated in right-to-left order. We need to "stack" them up, then print them out from top to bottom.. In these problems we need a"last-discarded-first-removed,""last-pushed-onto-first-removed," "last-stored-first-removed, " "last-generated-first-displayed"

kaycee
Download Presentation

Chapter 4: Stacks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Chapter 4: Stacks

    2. LIFO

    3. Stack as an ADT

    4. Example use of Stack

    5. Example (contd.)

    6. Base10 to Base2 Conversion

    8. Building a Stack Class

    9. Stack Operations:

    10. 2. Implementing a Stack Class

    11. Implementing Stack Class Refined

    12. Stack's Data Members

    13. Notes

    15. Stack.h

    16. Stack.h (contd.)

    17. Stack's Function Members

    18. A sample declaration

    19. Empty Member Function

    20. Test Driver Program

    21. Push member function

    22. Add to Stack.cpp

    23. Build the Test Driver AS you build the program itself:

    24. Display: So we can test our operations.

    26. Top Member Function

    27. Add to Stack.cpp:

    28. Pop Member Function

    29. Pop (contd.)

    30. Application of Stacks: Run-time Stack

    32. Run-time Stack Process

    34. Application of Stacks: RPN

    35. Evaluating RPN Expressions

    37. Sample RPN Evaluation (p. 196)

    38. Unary minus causes problems

    39. Converting Infix to RPN

More Related