diff --git a/Arrays/README.md b/Arrays/README.md new file mode 100644 index 0000000..b6d921b --- /dev/null +++ b/Arrays/README.md @@ -0,0 +1,17 @@ +# Arrays + +This directory contains Python implementations of common array-related problems and algorithms. + +## Contents + +### Anagram Check +Checks if two strings are anagrams of each other. +- **Files**: `Anagram_Check_Sorted_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` + +### Find Missing Element +Find the missing element in a shuffled second array. +- **Files**: `ArrayFindTheMissingElement_XOR_sol.py`, `ArrayFindTheMissingElement_brute_force_sol.py`, `ArrayFindTheMissingElement_hash_table_sol.py`, `ArrayFindTheMissingElement_takingSumandSubtract_sol.py` diff --git a/Error-debug/README.md b/Error-debug/README.md new file mode 100644 index 0000000..e7df218 --- /dev/null +++ b/Error-debug/README.md @@ -0,0 +1,9 @@ +# Error Handling + +This directory contains examples and scripts demonstrating error handling and debugging techniques in Python. + +## Contents + +### Basic Exception Handling +Demonstrates `try-except-else-finally` blocks and user input validation. +- **File**: `ErrorExceptions.py` diff --git a/GraphAlgorithms/README.md b/GraphAlgorithms/README.md new file mode 100644 index 0000000..d5638fc --- /dev/null +++ b/GraphAlgorithms/README.md @@ -0,0 +1,21 @@ +# Graph Algorithms + +This directory contains Python implementations of common graph algorithms and data structures. + +## Contents + +### Adjacency List Implementation +Basic representation of a graph using an adjacency list. +- **File**: `AdjacencyListGraphImple.py` + +### Breadth First Search (BFS) - Word Ladder Problem +Implementations related to BFS and its application in solving the word ladder puzzle. +- **Files**: `BFS.py`, `WordLadderProblem.py` + +### Depth First Search (DFS) - Knight's Tour Problem +Implementations of DFS and the Knight's Tour problem. +- **Files**: `DFSImpleTheKnightsTourProblem.py`, `TheKnightsTourProblem.py` + +### General DFS +A more general implementation of Depth First Search. +- **File**: `DFSGeneral.py` diff --git a/LinkedLists/README.md b/LinkedLists/README.md new file mode 100644 index 0000000..b6a4927 --- /dev/null +++ b/LinkedLists/README.md @@ -0,0 +1,25 @@ +# Linked Lists + +This directory contains implementations of various types of linked lists and common linked list algorithms in Python. + +## Contents + +### Singly Linked List Implementation +Basic skeleton for a Singly Linked List. +- **File**: `SingleLinkedListImple.py` + +### Doubly Linked List Implementation +Basic skeleton for a Doubly Linked List. +- **File**: `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` + +### Reverse a Linked List +Reverse a linked list in-place. +- **File**: `LinkedListReversal.py` + +### Nth to Last Node +Find the nth to last node in a linked list. +- **File**: `LinkedListNthToLastNode.py` diff --git a/Queues/README.md b/Queues/README.md new file mode 100644 index 0000000..0aa06b8 --- /dev/null +++ b/Queues/README.md @@ -0,0 +1,13 @@ +# Queues + +This directory contains Python implementations of the Queue data structure. + +## Contents + +### Queue Implementation +Basic queue operations (FIFO): `enqueue`, `dequeue`, `isEmpty`, `size`. +- **File**: `QueueImple.py` + +### Queue with Two Stacks +Implementation of a queue using two stacks. +- **File**: `QueueWith2StacksImple.py` diff --git a/README.md b/README.md index 790acf4..54ef7d2 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,10 @@ Trim a BST so all nodes are within a given range `[min, max]`. Implementing a tree using classes and references. - **File**: `Trees/TreeRepresentationWithNodesReferences.py` +### Tree Representation (List of Lists) +Implementing a tree using a list of lists representation. +- **File**: `Trees/buildTreeTest.py` + ### Tree Level Order Print Print a binary tree in level order. - **File**: `Trees/TreeLevelOrderPrintImple.py` diff --git a/Recursion/README.md b/Recursion/README.md new file mode 100644 index 0000000..e4556f1 --- /dev/null +++ b/Recursion/README.md @@ -0,0 +1,33 @@ +# Recursion + +This directory contains various Python examples demonstrating recursive algorithms and techniques. + +## Contents + +### Cumulative Sum +Compute the cumulative sum from 0 to `n`. +- **File**: `RecursionCumulativeSum.py` + +### Sum of Digits +Returns the sum of all individual digits in an integer. +- **File**: `RecursionSumOfDigits.py` + +### Word Split +Determine if a string can be split into words found in a given list. +- **File**: `RecursionWordSplit.py` + +### Reverse a String +Recursive implementation to reverse a string. +- **File**: `RecursionReverseStr.py` + +### String Permutations +Output all possible permutations of a string. +- **File**: `RecursionStrPermutation.py` + +### Fibonacci Sequence +Implementations using recursion, iteration, and dynamic programming (memoization). +- **Files**: `FibonacciSeqRecursion.py`, `FibonacciSeqIterative.py`, `FibonacciSeqDynamic.py` + +### Coin Change Problem +Find the fewest coins needed to make a change amount. +- **Files**: `CoinChangeProblemRecursion.py`, `CoinChangeProblemDynamic.py` diff --git a/Sorting/README.md b/Sorting/README.md new file mode 100644 index 0000000..ab6e0e9 --- /dev/null +++ b/Sorting/README.md @@ -0,0 +1,23 @@ +# Sorting + +This directory contains Python implementations of common sorting algorithms. + +## Contents + +### Bubble Sort +- **File**: `BubbleSortImple.py` + +### Selection Sort +- **File**: `SelectionSortImple.py` + +### Insertion Sort +- **File**: `InsertionSortImple.py` + +### Merge Sort +- **File**: `MergeSortImple.py` + +### Quick Sort +- **File**: `QuickSortImple.py` + +### Shell Sort +- **File**: `ShellSortImple.py` diff --git a/Stacks/README.md b/Stacks/README.md new file mode 100644 index 0000000..660f83b --- /dev/null +++ b/Stacks/README.md @@ -0,0 +1,13 @@ +# Stacks + +This directory contains Python implementations of the Stack data structure and related algorithms. + +## Contents + +### Stack Implementation +Basic stack operations (LIFO): `push`, `pop`, `peek`, `isEmpty`, `size`. +- **File**: `StackImple.py` + +### Balanced Parentheses Check +Check if a string of opening and closing parentheses is balanced. +- **File**: `BalanceParenthlessCheckImple.py` diff --git a/Trees/README.md b/Trees/README.md new file mode 100644 index 0000000..d5bc3e4 --- /dev/null +++ b/Trees/README.md @@ -0,0 +1,35 @@ +# Trees + +This directory contains Python implementations of binary trees and related algorithms. + +## Contents + +### Binary Search Tree Implementation +- **File**: `BinarySearchTreesImple.py` + +### Binary Heap Implementation +- **File**: `BinaryHeapImple.py` + +### Binary Search +Recursive and iterative implementations. +- **Files**: `BinarySearchImple.py`, `BinarySearchRecursiveImple.py` + +### Validate BST +Check if a binary tree is a valid Binary Search Tree. +- **Files**: `BinarySearchTreeCheckImpleSol1.py`, `BinarySearchTreeCheckImpleSol2.py` + +### Trim a BST +Trim a BST so all nodes are within a given range `[min, max]`. +- **File**: `TrimBinarySearchTreeImple.py` + +### Tree Representation (Nodes & References) +Implementing a tree using classes and references. +- **File**: `TreeRepresentationWithNodesReferences.py` + +### Tree Representation (List of Lists) +Implementing a tree using a list of lists representation. +- **File**: `buildTreeTest.py` + +### Tree Level Order Print +Print a binary tree in level order. +- **File**: `TreeLevelOrderPrintImple.py` diff --git a/deque/README.md b/deque/README.md new file mode 100644 index 0000000..1582147 --- /dev/null +++ b/deque/README.md @@ -0,0 +1,9 @@ +# Deque + +This directory contains Python implementations of the Double-ended queue (Deque) data structure. + +## Contents + +### Deque Implementation +Double-ended queue operations: `addFront`, `addRear`, `removeFront`, `removeRear`, `isEmpty`, `size`. +- **File**: `DequeImple.py`