Skip to content

Created for my A Level 'Fudamentals of Data Structures P1 AQA' Revision

Notifications You must be signed in to change notification settings

LongJohnTeabag11/DataStructures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Data Structures Terminal

This repository contains a Python program that implements basic data structures - Queues and Stacks. The program allows users to perform various operations such as enqueue, dequeue, check size, check if the structure is empty, and more.

Usage:

[Queues]

Enqueue (Add an item to the queue):

--> Prompts the user to enter an item to add to the queue.
--> Adds the item to the queue.

Dequeue (Remove and return an item from the front of the queue):

--> Removes and displays the item at the front of the queue.
--> Handles underflow error if the queue is empty.

Size (Get the size of the queue):

--> Displays the current size of the queue.

Is Empty (Check if the queue is empty):

--> Displays whether the queue is empty or not.

Format Menu (Choose the format for displaying the queue):

Options:

Priority Queue (using Bubble Sort)
Linear Queue
Exit

[Stacks]

Push (Add an item to the stack):

--> Prompts the user to enter an item to add to the stack.
--> Adds the item to the top of the stack.

Pop (Remove and return an item from the top of the stack):

--> Removes and displays the item from the top of the stack.
--> Handles underflow error if the stack is empty.

Is Empty (Check if the stack is empty):

--> Displays whether the stack is empty or not.

Size (Get the size of the stack):

--> Displays the current size of the stack.

Exit:

--> Exits the program.

Download

Download the Code

How to Run

1) Clone the repository to your local machine.

2) Open a terminal or command prompt.

3) Navigate to the directory containing the script.

4) Run the script using the following command:

python script_name.py    

*(Replace script_name.py with the actual name of the Python script.)

Note

The program includes a simple menu system for user interaction. Both the Queue and Stack classes are implemented with various methods for different operations.
The Queue class provides options to display the queue as a Priority Queue (using Bubble Sort) or as a Linear Queue.
The Stack class allows users to perform basic stack operations such as push, pop, check if it's empty, and get its size.
Feel free to explore and use this program as a reference for understanding basic data structures in Python.
This program was also created for educational purposes to assist A Level Revision for the Paper 1 AQA Exam.

About

Created for my A Level 'Fudamentals of Data Structures P1 AQA' Revision

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published