Welcome to my personal collection of data structures and algorithms implemented from scratch in Python! This repository documents my journey of mastering core computer science concepts, optimizing code efficiency, and analyzing complexity.
Here are the specific algorithmic challenges I have solved and optimized so far:
- The Problem: Protecting an API or server from being spammed by a single user sending too many requests.
- The Solution: Implemented a highly optimized tracking mechanism using a Python Dictionary and a
whileloop with.pop(0). It tracks user timestamps within a dynamic window (e.g., 10 seconds) and automatically drops expired data to keep memory usage minimal.
- The Problem: Finding two numbers in an array that add up to a specific target.
-
The Optimization: Moved away from a slow Brute-Force approach ($O(N^2)$) and optimized it using a Python Dictionary (Hash Map) to achieve a lightning-fast
$O(N)$ time complexity, scanning the list only once.
Through these challenges, I am learning how to shift from slow code to efficient code:
- Shifting from
$O(N^2)$ (Brute-force) to$O(N)$ (Optimized). - Understanding how memory allocation changes based on the data structures used.
I use this repository to practice translating algorithmic theory into clean, working Python code. I will keep adding more algorithms here as I continue studying computer science and problem-solving concepts!
Feel free to browse the solutions or drop a β if you find these challenges interesting!