Module 3: Stacks

CMPS 260: Data Structures

Introduction

Stacks are another classical data structure and follow the last in first out principle. For example, when creating a stack of books the last one that goes on top is also the first one to come off again. Instead of saying add and remove (as we do with arrays) we say push and pop in case of stacks. A big difference between arrays and stacks is that elements on a stack are not retrieved by index. One operation that is common is to peek at the top element without removing it. We will look at some problems that use stacks, such as converting decimal numbers to binary.

Module Objectives

  • Implement and use the stack data structure
  • Solve problems using stacks

Learning Resources

  • Module 3 Readings: Chapter 3 (skip ECMAScript sections)
  • Module 3 Slides: Chapter 3

Learning Activities

  • Module 3 Assignment

Video

For Further Study

  • Read more about stacks on Wikipedia
  • Read more about stacks on Wikibooks

Leave A Reply

Your email address will not be published. Required fields are marked *