Skip to content

leowuniv/Roller-Coaster-Lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Roller-Coaster-Lab

Lab Week 7 - Spring 2025 🎢

Overview

This week, you'll practice implementing and using three fundamental data structures: Stacks, Queues, and Priority Queues. You will create a simplified theme park ride management simulation to better understand how these structures manage data.

Objectives

  • Implement a Stack (LIFO) to simulate guests using an elevator-style ride (loading and unloading guests).

  • Implement a Queue (FIFO) to manage guests waiting in line for a popular roller coaster.

  • Implement a Priority Queue to manage guests based on VIP status or Fast Pass holders.

  • Demonstrate the practical use of stacks, queues, and priority queues through interactive simulation.


Part 1: Stack – Elevator Drop Ride Simulation

Create a class ElevatorRide:

  • Use a stack to simulate guests entering an elevator ride.

  • Guests board one at a time and exit in reverse order (the last person in is the first out).

  • Methods required:

    • board_guest(guest_name) - adds a guest.

    • start_ride(capacity) - simulates the ride, displaying guest names as they exit.


Part 2: Queue – Roller Coaster Ride Simulation

Create a class RollerCoasterRide:

  • Use a queue to manage guests waiting for the roller coaster.

  • Guests enter the queue and exit in the same order they arrived (first in, first out).

  • Methods required:

    • join_queue(guest_name) - adds a guest to the line.

    • start_ride(capacity) - simulates loading and running the coaster, displaying guest names as they board.


Part 3: Priority Queue – VIP Guest Management

Create a class VIPRide:

  • Use a priority queue to manage guests based on priority levels (e.g., VIP or Fast Pass holders).

  • Guests with higher priority board the ride before others.

  • Methods required:

    • add_guest(guest_name, priority) - adds a guest with their priority (lower number indicates higher priority).

    • start_ride(capacity) - simulates the ride, displaying guest names as they board based on priority.


Rubric

- Stack and Queue implementation (30%)
- Priority queue for VIPs (30%)
- Demo Questions (30%)
- Code Quality and Style (10%)

What to submit:

- Your code as a .py or .ipynb file
- A screenshot of the output you will have while testing your program

About

Lab Week 7

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages