This repository is a study collection for data structures and algorithms in Python. It contains sample code, exercises, lecture materials, and reference documents for topics such as linked lists, stacks, queues, trees, heaps, hashing, sorting, graphs, and shortest path algorithms.
The goal of the repo is to gather examples for reviewing core concepts such as linked lists, stacks, queues, trees, heaps, hashing, sorting, graphs, and shortest path, along with basic OOP examples used in class and exam practice.
- Basic data structures such as Stack, Queue, and Singly Linked List
- Object-oriented programming concepts such as encapsulation, inheritance, overriding, static members, and properties
- Sample code used in the Data Structures & Algorithms course
- Lecture PDFs and images used as teaching materials
- Files that contain multiple experimental versions of the same topic, with older examples often kept in comments
python-data-structures-and-algorithms/
├── Exams/
│ ├── BasicQueue.py
│ ├── BasicSinglyLinkedList.py
│ ├── BasicStack.py
│ ├── Lecture 2.py
│ ├── LinkedList.py
│ ├── PythonOop.py
│ ├── Queue.py
│ └── Student.py
└── Lectures/
├── 0Exercises/
├── Assignment 1 Linked List/
├── Assignment 2 Construct Binary Tree/
├── Assignment 3 Binary Heap/
├── Assignment 4 Shortest Path/
├── Lecture 1 Introduction/
├── Lecture 2 Review Python/
├── Lecture 3 Linked List/
├── Lecture 4 Stack/
├── Lecture 5 Tree/
├── Lecture 5.1 Binary Search Tree/
├── Lecture 5.2 Binary Search Tree Remove/
├── Lecture 7 Hashing/
├── Lecture 8 Priority Queue (Heap)/
├── Lecture 8.1 Priority Queue (Insert and deleteMin)/
├── Lecture 9 Sorting/
├── Lecture 10 Graph/
├── Lecture 11 Shortest path/
├── Data Structures & Algorithms in Python.pdf
└── planstd060243106.pdf
This folder contains short examples used for exams, practice, or quick demonstrations.
BasicStack.pyexample of a stack implemented with a Python listBasicQueue.pybasic queue exampleBasicSinglyLinkedList.pyexample of a singly linked listLinkedList.pymultiple experimental versions of linked list codeQueue.pyanother queue example with front/rear and size controlPythonOop.pyOOP examples such as encapsulation, property, static variable, inheritance, and overridingStudent.pystudent class with properties and grade conversion methodsLecture 2.pybasic lecture example such as thePointclass
This folder stores lecture and assignment materials organized by topic.
- Introduction and Python review
- Linked List, Stack, Tree, and Binary Search Tree
- Hashing and Priority Queue / Heap
- Sorting, Graph, and Shortest Path
- Exercises and assignments for each topic
Some folders may contain code files, PDFs, or supporting images to use alongside slides and lecture notes.
Quick start:
- Install Python 3.x
- Open a terminal at the repository root
- Run any example with
python
This project does not use a complex framework or external dependencies. You can run it with standard Python.
- Install Python 3.x
- Open a terminal at the repository root
- Run the file you want with the
pythoncommand
Examples:
python Exams/BasicStack.py
python Exams/BasicQueue.py
python Exams/Student.pyOn Windows, quote paths that contain spaces.
python "Exams/PythonOop.py"- Some files contain multiple versions of the same idea in one file, with older versions commented out.
- Many examples are written for teaching, so they may emphasize clarity over production-ready completeness.
- Some examples use slightly different method names or naming styles to reflect the course progression.
- PDF and image files are supporting documents, not executable code.
You can use this repository in several ways:
- Read it as a study summary before exams
- Run each example file to see output and data flow
- Modify the code to experiment with how each data structure behaves
- Use the files in
Lectures/as references when doing assignments or writing your own notes
The code in this repository is educational, so it may include the following:
- Some methods use simplified return or display behavior
- Some examples may not handle every edge case
- Some classes are experimental versions used to compare multiple implementation styles
If you want to reuse the code in another project, you should review validation, error handling, and performance.
If you continue developing this repo, you can add:
- A README in each lecture folder with more detailed explanations
- A
requirements.txtfile if external dependencies are added later - Tests for Stack, Queue, and LinkedList behavior
- Cleaner reference versions of the teaching code for comparison
No license is currently specified in this repository. If you plan to publish or share it publicly, add a clear license first.