Page 290 - Learn to Program - Basic-256
P. 290

Chapter 19: Stacks, Queues, Lists, and Sorting                                  Page 274


        Chapter 19: Stacks, Queues, Lists, and

               Sorting





               This chapter introduces a few advanced topics that are commonly covered in
               the first Computer Science class at the University level. The first three topics
               (Stack, Queue, and Linked List) are very common ways that information is
               stored in a computer system. The last two are algorithms for sorting
               information.



        Stack:



               A stack is one of the common data structures used by programmers to do
               many tasks. A stack works like the "discard pile" when you play the card
               game "crazy-eights". When you add a piece of data to a stack it is done on
               the top (called a "push") and these items stack upon each other. When you
               want a piece of information you take the top one off the stack and reveal the
               next one down (called a "pop"). Illustration 31 shows a graphical example.































                                                       © 2019 James M. Reneau (CC BY-NC-SA 3.0 US)
   285   286   287   288   289   290   291   292   293   294   295