diff --git a/Arrays/README.md b/Arrays/README.md index 707a82e..85419cb 100644 --- a/Arrays/README.md +++ b/Arrays/README.md @@ -4,10 +4,10 @@ This directory contains Python implementations of common array-based algorithms ## Contents -- [Anagram Check (Sorted Solution)](Anagram_Check_Sorted_Sol.py): Checks if two strings are anagrams by comparing their sorted versions. -- [Anagram Check (Manual Solution)](Anagram_Check_manual_Sol.py): Checks if two strings are anagrams using a hash table (dictionary) to count character frequencies. -- [Array Find Missing Element (XOR Solution)](ArrayFindTheMissingElement_XOR_sol.py): Efficiently finds a missing element in a shuffled array using bitwise XOR. -- [Array Find Missing Element (Brute Force Solution)](ArrayFindTheMissingElement_brute_force_sol.py): Finds a missing element by sorting both arrays and comparing them. -- [Array Find Missing Element (Hash Table Solution)](ArrayFindTheMissingElement_hash_table_sol.py): Finds a missing element using a hash table (dictionary) to track element counts. -- [Array Find Missing Element (Sum/Subtract Solution)](ArrayFindTheMissingElement_takingSumandSubtract_sol.py): Finds a missing element by calculating the difference between the sums of the two arrays. +- [Anagram Check (Sorted Solution)](Anagram_Check_Sorted_Sol.py): Checks if two strings are anagrams by comparing their sorted versions. $O(n \log n)$ +- [Anagram Check (Manual Solution)](Anagram_Check_manual_Sol.py): Checks if two strings are anagrams using a hash table (dictionary) to count character frequencies. $O(n)$ +- [Array Find Missing Element (XOR Solution)](ArrayFindTheMissingElement_XOR_sol.py): Efficiently finds a missing element in a shuffled array using bitwise XOR. $O(n)$ +- [Array Find Missing Element (Brute Force Solution)](ArrayFindTheMissingElement_brute_force_sol.py): Finds a missing element by sorting both arrays and comparing them. $O(n \log n)$ +- [Array Find Missing Element (Hash Table Solution)](ArrayFindTheMissingElement_hash_table_sol.py): Finds a missing element using a hash table (dictionary) to track element counts. $O(n)$ +- [Array Find Missing Element (Sum/Subtract Solution)](ArrayFindTheMissingElement_takingSumandSubtract_sol.py): Finds a missing element by calculating the difference between the sums of the two arrays. $O(n)$ - [Array Pair Sum Solution](ArrayPairSumSol.py): Finds all unique pairs in an array that sum up to a specific value $k$ using a set for $O(n)$ complexity. diff --git a/deque/DequeImple.py b/Deque/DequeImple.py similarity index 100% rename from deque/DequeImple.py rename to Deque/DequeImple.py diff --git a/deque/README.md b/Deque/README.md similarity index 80% rename from deque/README.md rename to Deque/README.md index 046a17f..e3c3a05 100644 --- a/deque/README.md +++ b/Deque/README.md @@ -5,3 +5,5 @@ This directory contains Python implementations of the Deque (Double-Ended Queue) ## Contents - [Deque Implementation](DequeImple.py): Basic implementation of a Deque using a Python list. Includes operations like `addFront`, `addRear`, `removeFront`, `removeRear`, `isEmpty`, and `size`. + - `addFront`, `removeFront`: $O(1)$ + - `addRear`, `removeRear`: $O(n)$ diff --git a/Error-debug/ErrorExceptions.py b/ErrorHandling/ErrorExceptions.py similarity index 100% rename from Error-debug/ErrorExceptions.py rename to ErrorHandling/ErrorExceptions.py diff --git a/Error-debug/README.md b/ErrorHandling/README.md similarity index 92% rename from Error-debug/README.md rename to ErrorHandling/README.md index c8bc4d4..93599e6 100644 --- a/Error-debug/README.md +++ b/ErrorHandling/README.md @@ -1,4 +1,4 @@ -# Error and Debugging +# Error Handling This directory contains examples of error handling and debugging techniques in Python. diff --git a/Queues/README.md b/Queues/README.md index a1c90d0..1be0140 100644 --- a/Queues/README.md +++ b/Queues/README.md @@ -5,4 +5,6 @@ This directory contains Python implementations of the Queue data structure. ## Contents - [Queue Implementation](QueueImple.py): Basic implementation of a FIFO (First-In-First-Out) queue using a Python list. Includes `enqueue`, `dequeue`, `isEmpty`, and `size` methods. -- [Queue with Two Stacks](QueueWith2StacksImple.py): Implements a queue using two stacks (represented by Python lists) to achieve FIFO behavior. + - `enqueue`: $O(n)$ + - `dequeue`: $O(1)$ +- [Queue with Two Stacks](QueueWith2StacksImple.py): Implements a queue using two stacks (represented by Python lists) to achieve FIFO behavior. $O(1)$ amortized for both operations. diff --git a/README.md b/README.md index b8de7d5..f8746fc 100644 --- a/README.md +++ b/README.md @@ -35,20 +35,20 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details. ## πŸ“– Table of Contents -- [Getting Started](#getting-started) -- [Project Structure](#project-structure) -- [Data Structures](#data-structures) - - [Arrays](#arrays) - - [Linked Lists](#linked-lists) - - [Stacks](#stacks) - - [Queues](#queues) - - [Deque](#deque) - - [Trees](#trees) -- [Algorithms](#algorithms) - - [Sorting](#sorting) - - [Recursion & Dynamic Programming](#recursion--dynamic-programming) - - [Graph Algorithms](#graph-algorithms) -- [Error Handling & Debugging](#error-handling--debugging) +- [Getting Started](#-getting-started) +- [Project Structure](#-project-structure) +- [Data Structures](#-data-structures) + - [Arrays](#arrays-) + - [Linked Lists](#linked-lists-) + - [Stacks](#stacks-) + - [Queues](#queues-) + - [Deque](#deque-) + - [Trees](#trees-) +- [Algorithms](#-algorithms) + - [Sorting](#sorting-) + - [Recursion & Dynamic Programming](#recursion--dynamic-programming-) + - [Graph Algorithms](#graph-algorithms-) +- [Error Handling & Debugging](#-error-handling--debugging) - [Usage](#usage) - [Quick Reference](#quick-reference) - [License](#license) @@ -80,7 +80,7 @@ python3 Sorting/BubbleSortImple.py ``` . β”œβ”€β”€ Arrays/ # πŸ”€ Array-based problems and algorithms -β”œβ”€β”€ Error-debug/ # ⚠️ Error handling and debugging examples +β”œβ”€β”€ ErrorHandling/ # ⚠️ Error handling and debugging examples β”œβ”€β”€ GraphAlgorithms/ # πŸ—ΊοΈ Graph traversal (BFS, DFS) and pathfinding β”œβ”€β”€ LinkedLists/ # πŸ”— Singly and Doubly Linked Lists β”œβ”€β”€ Queues/ # πŸ“¦ Queue implementations (FIFO) @@ -88,7 +88,7 @@ python3 Sorting/BubbleSortImple.py β”œβ”€β”€ Sorting/ # πŸ“Š Common sorting algorithms β”œβ”€β”€ Stacks/ # πŸ“š Stack implementations and applications β”œβ”€β”€ Trees/ # 🌳 Binary Trees, BSTs, Heaps, and Traversals -β”œβ”€β”€ deque/ # πŸ”„ Double-ended queue +β”œβ”€β”€ Deque/ # πŸ”„ Double-ended queue β”œβ”€β”€ CONTRIBUTING.md # 🀝 Contribution guidelines β”œβ”€β”€ LICENSE # πŸ“„ MIT License └── README.md # πŸ“– This file @@ -123,7 +123,7 @@ FIFO (First-In-First-Out) data structures. ### Deque πŸ”„ Double-ended queue operations. -- [Deque Implementation](deque/DequeImple.py): Operations at both ends +- [Deque Implementation](Deque/DequeImple.py): Operations at both ends ### Trees 🌳 Hierarchical data structures. @@ -168,7 +168,7 @@ Algorithms for graph traversal and pathfinding. ## ⚠️ Error Handling & Debugging -- [Error and Exceptions](Error-debug/ErrorExceptions.py): Demonstrates `try`, `except`, `else`, and `finally` blocks for robust error handling. +- [Error and Exceptions](ErrorHandling/ErrorExceptions.py): Demonstrates `try`, `except`, `else`, and `finally` blocks for robust error handling. --- diff --git a/Recursion/README.md b/Recursion/README.md index 7265340..2feaa3d 100644 --- a/Recursion/README.md +++ b/Recursion/README.md @@ -5,17 +5,17 @@ This directory contains Python implementations of problems solved using recursio ## Contents ### Fibonacci Sequence -- [Fibonacci (Iterative)](FibonacciSeqIterative.py): Iterative implementation of the Fibonacci sequence. -- [Fibonacci (Recursive)](FibonacciSeqRecursion.py): Simple recursive implementation of the Fibonacci sequence. -- [Fibonacci (Dynamic Programming)](FibonacciSeqDynamic.py): Optimized Fibonacci sequence using memoization. +- [Fibonacci (Iterative)](FibonacciSeqIterative.py): Iterative implementation of the Fibonacci sequence. $O(n)$ +- [Fibonacci (Recursive)](FibonacciSeqRecursion.py): Simple recursive implementation of the Fibonacci sequence. $O(2^n)$ +- [Fibonacci (Dynamic Programming)](FibonacciSeqDynamic.py): Optimized Fibonacci sequence using memoization. $O(n)$ ### Coin Change Problem - [Coin Change (Recursive)](CoinChangeProblemRecursion.py): Basic recursive solution to find the minimum number of coins for change. - [Coin Change (Dynamic Programming)](CoinChangeProblemDynamic.py): Optimized solution to the coin change problem using dynamic programming. ### Other Recursive Problems -- [Cumulative Sum](RecursionCumulativeSum.py): Computes the cumulative sum from 0 to $n$ recursively. -- [Reverse a String](RecursionReverseStr.py): Reverses a string using recursive calls. -- [String Permutations](RecursionStrPermutation.py): Generates all possible permutations of a given string. -- [Sum of Digits](RecursionSumOfDigits.py): Calculates the sum of all individual digits in an integer recursively. +- [Cumulative Sum](RecursionCumulativeSum.py): Computes the cumulative sum from 0 to $n$ recursively. $O(n)$ +- [Reverse a String](RecursionReverseStr.py): Reverses a string using recursive calls. $O(n)$ +- [String Permutations](RecursionStrPermutation.py): Generates all possible permutations of a given string. $O(n!)$ +- [Sum of Digits](RecursionSumOfDigits.py): Calculates the sum of all individual digits in an integer recursively. $O(\log_{10} n)$ - [Word Split](RecursionWordSplit.py): Determines if a string can be split into words from a given list. diff --git a/Sorting/README.md b/Sorting/README.md index 0b76399..cdcc60f 100644 --- a/Sorting/README.md +++ b/Sorting/README.md @@ -5,8 +5,8 @@ This directory contains Python implementations of various sorting algorithms wit ## Contents - [Bubble Sort](BubbleSortImple.py): Implementation of Bubble Sort with $O(n^2)$ complexity. -- [Selection Sort](SelectionSortImple.py): Implementation of Selection Sort, improving on Bubble Sort by making only one exchange per pass. -- [Insertion Sort](InsertionSortImple.py): Implementation of Insertion Sort, maintaining a sorted sublist. -- [Shell Sort](ShellSortImple.py): Implementation of Shell Sort (diminishing increment sort), improving on Insertion Sort. +- [Selection Sort](SelectionSortImple.py): Implementation of Selection Sort, improving on Bubble Sort by making only one exchange per pass. $O(n^2)$ +- [Insertion Sort](InsertionSortImple.py): Implementation of Insertion Sort, maintaining a sorted sublist. $O(n^2)$ +- [Shell Sort](ShellSortImple.py): Implementation of Shell Sort (diminishing increment sort), improving on Insertion Sort. Worst-case $O(n^2)$. - [Merge Sort](MergeSortImple.py): A recursive "divide and conquer" algorithm with $O(n \log n)$ complexity. -- [Quick Sort](QuickSortImple.py): Implementation of Quick Sort (partition exchange sort), using divide and conquer in-place. +- [Quick Sort](QuickSortImple.py): Implementation of Quick Sort (partition exchange sort), using divide and conquer in-place. $O(n \log n)$ average.