Stacks and Queues: Selecting the Ideal Data Structure

There are a variety of ways for storing and managing data in your program and the choice of the right data structure has an effect on the readability of your code, ease of writing, and performance. Python has a wide selection of built-in mechanisms that meet most of your data structure needs. This course introduces you to three types of data structures: stacks, queues, and priority queues.

There are multiple types and classes for all of these data structures and this course discusses them and provides information on how to choose the right one.

In this course you’ll learn about:

  • How stacks are defined with Last-In/First-Out (LIFO) semantics
  • How to use the collections.deque object
  • How concurrency will affect your choice
  • What are priority queues
  • Which data structure methods are thread safe
  • How to decide between all of implementations of these data structures

The course is the third part of an ongoing series, exploring how to find the right Data Structure for your projects. The first course is Dictionaries and Arrays: Selecting the Ideal Data Structure and the second course is Records and Sets: Selecting the Ideal Data Structure.

What’s Included:

Downloadable Resources:

Related Learning Paths:

Stacks and Queues: Selecting the Ideal Data Structure

1 Lesson 2m

  1. 1. Stacks and Queues: Selecting the Ideal Data Structure (Overview)02:32

About Christopher Trudeau

Christopher has a passion for the Python language and writes for Real Python. He is a consultant who helps advise organizations on how to improve their technical teams.

» More about Christopher

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

Avatar image for marcinszydlowski1984

marcinszydlowski1984 on June 29, 2022

Best site about Python I’ve seen. The problems shown here aren’t Python-specific but the quality and simplicity of presented media is worth the price.

← Browse All Courses