diff --git a/Arrays/README.md b/Arrays/README.md new file mode 100644 index 0000000..b1c22a6 --- /dev/null +++ b/Arrays/README.md @@ -0,0 +1,17 @@ +# Arrays + +This directory contains implementations and problems related to Arrays. + +## Contents + +### Anagram Check +Checks if two strings are anagrams of each other. +- **Files**: [Anagram_Check_Sorted_Sol.py](Anagram_Check_Sorted_Sol.py), [Anagram_Check_manual_Sol.py](Anagram_Check_manual_Sol.py) + +### Array Pair Sum +Given an integer array, output all unique pairs that sum up to a specific value `k`. +- **File**: [ArrayPairSumSol.py](ArrayPairSumSol.py) + +### Find Missing Element +Find the missing element in a shuffled second array. +- **Files**: [ArrayFindTheMissingElement_XOR_sol.py](ArrayFindTheMissingElement_XOR_sol.py), [ArrayFindTheMissingElement_brute_force_sol.py](ArrayFindTheMissingElement_brute_force_sol.py), [ArrayFindTheMissingElement_hash_table_sol.py](ArrayFindTheMissingElement_hash_table_sol.py), [ArrayFindTheMissingElement_takingSumandSubtract_sol.py](ArrayFindTheMissingElement_takingSumandSubtract_sol.py) diff --git a/Error-debug/README.md b/Error-debug/README.md new file mode 100644 index 0000000..acfe1f5 --- /dev/null +++ b/Error-debug/README.md @@ -0,0 +1,9 @@ +# Error Handling + +This directory demonstrates error handling techniques in Python. + +## Contents + +### Basic Exception Handling +Demonstrates `try-except-else-finally` blocks and user input validation. +- **File**: [ErrorExceptions.py](ErrorExceptions.py) diff --git a/GraphAlgorithms/README.md b/GraphAlgorithms/README.md new file mode 100644 index 0000000..8a0e5ba --- /dev/null +++ b/GraphAlgorithms/README.md @@ -0,0 +1,18 @@ +# Graph Algorithms + +This directory contains implementations of various Graph Algorithms. + +## Contents + +### Adjacency List Implementation +- **File**: [AdjacencyListGraphImple.py](AdjacencyListGraphImple.py) + +### Breadth First Search (BFS) - Word Ladder Problem +- **Files**: [BFS.py](BFS.py), [WordLadderProblem.py](WordLadderProblem.py) + +### Depth First Search (DFS) - Knight's Tour Problem +- **Files**: [DFSImpleTheKnightsTourProblem.py](DFSImpleTheKnightsTourProblem.py), [TheKnightsTourProblem.py](TheKnightsTourProblem.py) + +### General DFS +A more general implementation of Depth First Search. +- **File**: [DFSGeneral.py](DFSGeneral.py) diff --git a/LinkedLists/README.md b/LinkedLists/README.md new file mode 100644 index 0000000..4ff329a --- /dev/null +++ b/LinkedLists/README.md @@ -0,0 +1,25 @@ +# Linked Lists + +This directory contains implementations and problems related to Linked Lists. + +## Contents + +### Singly Linked List Implementation +Basic skeleton for a Singly Linked List. +- **File**: [SingleLinkedListImple.py](SingleLinkedListImple.py) + +### Doubly Linked List Implementation +Basic skeleton for a Doubly Linked List. +- **File**: [DoublyLinkedListImple.py](DoublyLinkedListImple.py) + +### Singly Linked List Cycle Check +Check if a singly linked list contains a cycle using the "two runners" (slow and fast pointers) strategy. +- **File**: [SinglyLinkedListCycleCheckImple.py](SinglyLinkedListCycleCheckImple.py) + +### Reverse a Linked List +Reverse a linked list in-place. +- **File**: [LinkedListReversal.py](LinkedListReversal.py) + +### Nth to Last Node +Find the nth to last node in a linked list. +- **File**: [LinkedListNthToLastNode.py](LinkedListNthToLastNode.py) diff --git a/Queues/README.md b/Queues/README.md new file mode 100644 index 0000000..ab26ba9 --- /dev/null +++ b/Queues/README.md @@ -0,0 +1,13 @@ +# Queues + +This directory contains implementations of Queues. + +## Contents + +### Queue Implementation +Basic queue operations (FIFO): `enqueue`, `dequeue`, `isEmpty`, `size`. +- **File**: [QueueImple.py](QueueImple.py) + +### Queue with Two Stacks +Implement a queue using two stacks. +- **File**: [QueueWith2StacksImple.py](QueueWith2StacksImple.py) diff --git a/Recursion/README.md b/Recursion/README.md new file mode 100644 index 0000000..960d285 --- /dev/null +++ b/Recursion/README.md @@ -0,0 +1,33 @@ +# Recursion + +This directory contains implementations and problems related to Recursion. + +## Contents + +### Cumulative Sum +Compute the cumulative sum from 0 to `n`. +- **File**: [RecursionCumulativeSum.py](RecursionCumulativeSum.py) + +### Sum of Digits +Returns the sum of all individual digits in an integer. +- **File**: [RecursionSumOfDigits.py](RecursionSumOfDigits.py) + +### Word Split +Determine if a string can be split into words found in a given list. +- **File**: [RecursionWordSplit.py](RecursionWordSplit.py) + +### Reverse a String +Recursive implementation to reverse a string. +- **File**: [RecursionReverseStr.py](RecursionReverseStr.py) + +### String Permutations +Output all possible permutations of a string. +- **File**: [RecursionStrPermutation.py](RecursionStrPermutation.py) + +### Fibonacci Sequence +Implementations using iteration, recursion, and dynamic programming (memoization). +- **Files**: [FibonacciSeqIterative.py](FibonacciSeqIterative.py), [FibonacciSeqRecursion.py](FibonacciSeqRecursion.py), [FibonacciSeqDynamic.py](FibonacciSeqDynamic.py) + +### Coin Change Problem +Find the fewest coins needed to make a change amount. +- **Files**: [CoinChangeProblemRecursion.py](CoinChangeProblemRecursion.py), [CoinChangeProblemDynamic.py](CoinChangeProblemDynamic.py) diff --git a/Sorting/README.md b/Sorting/README.md new file mode 100644 index 0000000..f3bd584 --- /dev/null +++ b/Sorting/README.md @@ -0,0 +1,29 @@ +# Sorting + +This directory contains implementations of various Sorting Algorithms. + +## Contents + +### Bubble Sort +- **File**: [BubbleSortImple.py](BubbleSortImple.py) +- **Complexity**: $O(n^2)$ worst and average case, $O(n)$ best case. + +### Selection Sort +- **File**: [SelectionSortImple.py](SelectionSortImple.py) +- **Complexity**: $O(n^2)$ for all cases. + +### Insertion Sort +- **File**: [InsertionSortImple.py](InsertionSortImple.py) +- **Complexity**: $O(n^2)$ worst and average case, $O(n)$ best case. + +### Merge Sort +- **File**: [MergeSortImple.py](MergeSortImple.py) +- **Complexity**: $O(n \log n)$ for all cases. + +### Quick Sort +- **File**: [QuickSortImple.py](QuickSortImple.py) +- **Complexity**: $O(n^2)$ worst case, $O(n \log n)$ average/best case. + +### Shell Sort +- **File**: [ShellSortImple.py](ShellSortImple.py) +- **Complexity**: Between $O(n)$ and $O(n^2)$ depending on increment sequence. diff --git a/Stacks/README.md b/Stacks/README.md new file mode 100644 index 0000000..c302096 --- /dev/null +++ b/Stacks/README.md @@ -0,0 +1,13 @@ +# Stacks + +This directory contains implementations and problems related to Stacks. + +## Contents + +### Stack Implementation +Basic stack operations (LIFO): `push`, `pop`, `peek`, `isEmpty`, `size`. +- **File**: [StackImple.py](StackImple.py) + +### Balanced Parentheses Check +Check if a string of opening and closing parentheses is balanced. +- **File**: [BalanceParenthlessCheckImple.py](BalanceParenthlessCheckImple.py) diff --git a/Trees/README.md b/Trees/README.md new file mode 100644 index 0000000..79f3340 --- /dev/null +++ b/Trees/README.md @@ -0,0 +1,35 @@ +# Trees + +This directory contains implementations and problems related to Trees. + +## Contents + +### Binary Search Tree Implementation +- **File**: [BinarySearchTreesImple.py](BinarySearchTreesImple.py) + +### Binary Heap Implementation +- **File**: [BinaryHeapImple.py](BinaryHeapImple.py) + +### Binary Search +Recursive and iterative implementations. +- **Files**: [BinarySearchImple.py](BinarySearchImple.py), [BinarySearchRecursiveImple.py](BinarySearchRecursiveImple.py) + +### Validate BST +Check if a binary tree is a valid Binary Search Tree. +- **Files**: [BinarySearchTreeCheckImpleSol1.py](BinarySearchTreeCheckImpleSol1.py), [BinarySearchTreeCheckImpleSol2.py](BinarySearchTreeCheckImpleSol2.py) + +### Trim a BST +Trim a BST so all nodes are within a given range `[min, max]`. +- **File**: [TrimBinarySearchTreeImple.py](TrimBinarySearchTreeImple.py) + +### Tree Representation (Nodes & References) +Implementing a tree using classes and references. +- **File**: [TreeRepresentationWithNodesReferences.py](TreeRepresentationWithNodesReferences.py) + +### Tree Level Order Print +Print a binary tree in level order. +- **File**: [TreeLevelOrderPrintImple.py](TreeLevelOrderPrintImple.py) + +### Build Tree Test +Build a tree and fetch nodes and insert using list of lists. +- **File**: [buildTreeTest.py](buildTreeTest.py) diff --git a/deque/README.md b/deque/README.md new file mode 100644 index 0000000..a4a8c7d --- /dev/null +++ b/deque/README.md @@ -0,0 +1,9 @@ +# Deque + +This directory contains an implementation of Deque (Double-ended queue). + +## Contents + +### Deque Implementation +Double-ended queue operations: `addFront`, `addRear`, `removeFront`, `removeRear`, `isEmpty`, `size`. +- **File**: [DequeImple.py](DequeImple.py)