Data Structures & Algorithms (DSA) in Python
Welcome to my DSA repository! This project is a curated collection of Python scripts developed to master fundamental and advanced algorithmic concepts. It covers a wide spectrum of topics including recursion, sorting algorithms, tree structures, and mathematical series.
🚀 Overview
This repository serves as a technical showcase of my ability to implement complex logic and efficient data structures. Each script is designed for clarity, efficiency, and adherence to Pythonic coding standards.
📂 Project Structure
1. Sorting Algorithms
I have implemented several classic sorting algorithms, providing a deep dive into time and space complexity trade-offs.
I have implemented several classic sorting algorithms, providing a deep dive into time and space complexity trade-offs.
- Bubble Sort: A fundamental comparison-based algorithm. ``
- Selection Sort: Implementation focusing on finding minimum elements. ``
- Insertion Sort: Efficient for small datasets or nearly sorted arrays. ``
- Merge Sort: A robust Divide and Conquer implementation ensuring $O(n \log n)$ performance. ``
- Quick Sort: A high-performance partitioning algorithm using the Lomuto/Hoare-style logic. ``
2. Tree Structures (Binary Search Tree)
A comprehensive Binary Search Tree (BST) implementation featuring:
- Dynamic Operations: Insertion, search, and deletion (handling leaf, single-child, and two-child nodes). ``
- Traversals: In-Order, Pre-Order, and Post-Order traversal methods. ``
- Tree Stats: Methods to retrieve the root, minimum value, and maximum value within the structure. ``
3. Recursion & Combinatorics
Demonstrating the power of recursive thinking through various mathematical and string manipulation problems:
- Permutations: Algorithms to generate all possible string arrangements and count permutation totals. ``
- Factorials & Fibonacci: Standard recursive implementations with input validation for negative or decimal values. ``
- Exponentiation: Recursive power function ($x^y$). ``
4. Mathematical Series & Patterns
A collection of scripts solving specific series challenges, often found in competitive programming:
- Triangular Numbers & Cube Series: Recursive logic to calculate cumulative sums and cubic progressions. ``
- Custom Progressions: Implementations for specific series logic, such as $f(n) = f(n-1) + 4n + 1$. ``
🛠️ Technical Highlights
- Input Validation: Robust handling of edge cases (negative numbers, non-integers, and empty lists). ``
- Object-Oriented Programming (OOP): Use of classes and static methods for complex structures like BSTs. ``
- Performance Metrics: Inclusion of helper functions to calculate statistical data like Median and Range from sorted arrays. ``
评论