From 9246ef434caf5fa249e6ad77df08979caa90cc4c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 01:46:12 +0000 Subject: [PATCH] Add comprehensive README documentation to the root and all subdirectories. - Updated root README.md with missing file 'Trees/buildTreeTest.py', and added 'Usage' and 'License' sections. - Created README.md files for all 10 major subdirectories (Arrays, Error-debug, GraphAlgorithms, LinkedLists, Queues, Recursion, Sorting, Stacks, Trees, deque) containing localized content listings and descriptions. - Verified all documentation and tested representative Python scripts for functionality. Co-authored-by: ppant <149585+ppant@users.noreply.github.com> --- Arrays/README.md | 18 ++++++++++++++++++ Error-debug/README.md | 8 ++++++++ GraphAlgorithms/README.md | 17 +++++++++++++++++ LinkedLists/README.md | 14 ++++++++++++++ Queues/README.md | 11 +++++++++++ README.md | 20 ++++++++++++++++++++ Recursion/README.md | 21 +++++++++++++++++++++ Sorting/README.md | 13 +++++++++++++ Stacks/README.md | 11 +++++++++++ Trees/README.md | 21 +++++++++++++++++++++ deque/README.md | 8 ++++++++ 11 files changed, 162 insertions(+) create mode 100644 Arrays/README.md create mode 100644 Error-debug/README.md create mode 100644 GraphAlgorithms/README.md create mode 100644 LinkedLists/README.md create mode 100644 Queues/README.md create mode 100644 Recursion/README.md create mode 100644 Sorting/README.md create mode 100644 Stacks/README.md create mode 100644 Trees/README.md create mode 100644 deque/README.md diff --git a/Arrays/README.md b/Arrays/README.md new file mode 100644 index 0000000..3050ebd --- /dev/null +++ b/Arrays/README.md @@ -0,0 +1,18 @@ +# Arrays + +This directory contains implementations of array-based algorithms and common interview problems. + +## Contents + +### Anagram Check +- `Anagram_Check_Sorted_Sol.py`: Solution using sorting. +- `Anagram_Check_manual_Sol.py`: Manual solution using a frequency dictionary. + +### Array Pair Sum +- `ArrayPairSumSol.py`: Finds all unique pairs in an array that sum to a specific value. + +### Find Missing Element +- `ArrayFindTheMissingElement_XOR_sol.py`: Efficient solution using XOR. +- `ArrayFindTheMissingElement_brute_force_sol.py`: Simple brute force approach. +- `ArrayFindTheMissingElement_hash_table_sol.py`: Solution using a hash table for O(n) complexity. +- `ArrayFindTheMissingElement_takingSumandSubtract_sol.py`: Mathematical approach using sums. diff --git a/Error-debug/README.md b/Error-debug/README.md new file mode 100644 index 0000000..6aacdda --- /dev/null +++ b/Error-debug/README.md @@ -0,0 +1,8 @@ +# Error and Debugging + +This directory contains examples and scripts related to error handling and debugging in Python. + +## Contents + +### Basic Exception Handling +- `ErrorExceptions.py`: Demonstrates the use of `try`, `except`, `else`, and `finally` blocks for robust error management and user input validation. diff --git a/GraphAlgorithms/README.md b/GraphAlgorithms/README.md new file mode 100644 index 0000000..26486d5 --- /dev/null +++ b/GraphAlgorithms/README.md @@ -0,0 +1,17 @@ +# Graph Algorithms + +This directory contains implementations of fundamental graph algorithms and their application to classic problems. + +## Contents + +### Adjacency List +- `AdjacencyListGraphImple.py`: Core implementation of a graph using an adjacency list. + +### Breadth First Search (BFS) +- `BFS.py`: Standard implementation of BFS. +- `WordLadderProblem.py`: Application of BFS to solve the Word Ladder problem. + +### Depth First Search (DFS) +- `DFSGeneral.py`: A generalized implementation of DFS. +- `DFSImpleTheKnightsTourProblem.py`: DFS used in the Knight's Tour problem. +- `TheKnightsTourProblem.py`: Complete implementation for solving the Knight's Tour problem. diff --git a/LinkedLists/README.md b/LinkedLists/README.md new file mode 100644 index 0000000..7d333f5 --- /dev/null +++ b/LinkedLists/README.md @@ -0,0 +1,14 @@ +# Linked Lists + +This directory contains implementations of singly and doubly linked list data structures and common algorithms. + +## Contents + +### Singly Linked List +- `SingleLinkedListImple.py`: Core implementation of a singly linked list. +- `SinglyLinkedListCycleCheckImple.py`: Algorithm to detect cycles in a linked list. +- `LinkedListReversal.py`: In-place reversal of a linked list. +- `LinkedListNthToLastNode.py`: Efficiently find the nth to last node. + +### Doubly Linked List +- `DoublyLinkedListImple.py`: Core implementation of a doubly linked list. diff --git a/Queues/README.md b/Queues/README.md new file mode 100644 index 0000000..08180fd --- /dev/null +++ b/Queues/README.md @@ -0,0 +1,11 @@ +# Queues + +This directory contains implementations of basic queues and specialized queue-based algorithms. + +## Contents + +### Standard Queue +- `QueueImple.py`: Core implementation of a queue using the FIFO principle. + +### Queue using Two Stacks +- `QueueWith2StacksImple.py`: Innovative implementation of a queue using two stacks. diff --git a/README.md b/README.md index 790acf4..f1c4d2a 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ This repository contains a collection of common programming problems and data st - [Sorting](#sorting) - [Graph Algorithms](#graph-algorithms) - [Error Handling](#error-handling) +- [Usage](#usage) +- [License](#license) - [Acknowledgments](#acknowledgments) --- @@ -145,6 +147,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 approach. +- **File**: `Trees/buildTreeTest.py` + ### Tree Level Order Print Print a binary tree in level order. - **File**: `Trees/TreeLevelOrderPrintImple.py` @@ -204,6 +210,20 @@ Demonstrates `try-except-else-finally` blocks and user input validation. --- +## Usage +Most scripts in this repository are standalone Python files and can be executed directly using the Python 3 interpreter. +```bash +python3 path/to/script.py +``` + +--- + +## License +This project is licensed under the MIT License. +Copyright (c) 2017 Pradeep K. Pant. + +--- + ## Acknowledgments - [Python for Data Structures, Algorithms, and Interviews on Udemy](https://www.udemy.com) - [Problem Solving with Algorithms and Data Structures using Python](http://interactivepython.org/runestone/static/pythonds/index.html) diff --git a/Recursion/README.md b/Recursion/README.md new file mode 100644 index 0000000..fe30a54 --- /dev/null +++ b/Recursion/README.md @@ -0,0 +1,21 @@ +# Recursion + +This directory contains implementations of recursive and dynamic programming algorithms. + +## Contents + +### Basic Recursion +- `RecursionCumulativeSum.py`: Calculates the cumulative sum from 0 to n recursively. +- `RecursionSumOfDigits.py`: Recursive sum of individual digits in an integer. +- `RecursionWordSplit.py`: Determining if a string can be split into valid words. +- `RecursionReverseStr.py`: Recursive implementation to reverse a string. + +### Permutations and Sequences +- `RecursionStrPermutation.py`: Generates all possible permutations of a string. +- `FibonacciSeqIterative.py`: Iterative solution for the Fibonacci sequence. +- `FibonacciSeqRecursion.py`: Simple recursive solution for the Fibonacci sequence. +- `FibonacciSeqDynamic.py`: Optimized Fibonacci solution using dynamic programming (memoization). + +### Coin Change Problem +- `CoinChangeProblemRecursion.py`: Recursive solution to find the minimum number of coins for change. +- `CoinChangeProblemDynamic.py`: Optimized dynamic programming solution for the coin change problem. diff --git a/Sorting/README.md b/Sorting/README.md new file mode 100644 index 0000000..3af408d --- /dev/null +++ b/Sorting/README.md @@ -0,0 +1,13 @@ +# Sorting + +This directory contains implementations of various sorting algorithms with their time complexity details. + +## Contents + +### Standard Sorting Algorithms +- `BubbleSortImple.py`: Core implementation of the Bubble Sort algorithm. +- `SelectionSortImple.py`: Core implementation of the Selection Sort algorithm. +- `InsertionSortImple.py`: Core implementation of the Insertion Sort algorithm. +- `MergeSortImple.py`: Core implementation of the Merge Sort algorithm. +- `QuickSortImple.py`: Core implementation of the Quick Sort algorithm. +- `ShellSortImple.py`: Core implementation of the Shell Sort algorithm. diff --git a/Stacks/README.md b/Stacks/README.md new file mode 100644 index 0000000..4f178ba --- /dev/null +++ b/Stacks/README.md @@ -0,0 +1,11 @@ +# Stacks + +This directory contains implementations of stacks and related interview problems. + +## Contents + +### Standard Stack +- `StackImple.py`: Core implementation of a stack following the LIFO principle. + +### Balanced Parentheses Check +- `BalanceParenthlessCheckImple.py`: Algorithm to verify balanced opening and closing parentheses. diff --git a/Trees/README.md b/Trees/README.md new file mode 100644 index 0000000..f05b905 --- /dev/null +++ b/Trees/README.md @@ -0,0 +1,21 @@ +# Trees + +This directory contains implementations of binary trees, heaps, search algorithms, and common tree-related interview problems. + +## Contents + +### Binary Search Trees +- `BinarySearchTreesImple.py`: Core implementation of a binary search tree. +- `BinarySearchTreeCheckImpleSol1.py`: Validation check for binary search trees (Solution 1). +- `BinarySearchTreeCheckImpleSol2.py`: Validation check for binary search trees (Solution 2). +- `TrimBinarySearchTreeImple.py`: Algorithm to trim a binary search tree within a given range. + +### Search and Heaps +- `BinarySearchImple.py`: Iterative implementation of a binary search algorithm. +- `BinarySearchRecursiveImple.py`: Recursive implementation of a binary search algorithm. +- `BinaryHeapImple.py`: Core implementation of a binary heap. + +### Tree Representation and Printing +- `TreeRepresentationWithNodesReferences.py`: Implementation of a tree using a class-based node-and-reference model. +- `buildTreeTest.py`: Implementation of a tree using a list-of-lists approach. +- `TreeLevelOrderPrintImple.py`: Algorithm for level-order traversal and printing of a binary tree. diff --git a/deque/README.md b/deque/README.md new file mode 100644 index 0000000..52ba3ca --- /dev/null +++ b/deque/README.md @@ -0,0 +1,8 @@ +# Deque + +This directory contains implementations of a double-ended queue. + +## Contents + +### Standard Deque +- `DequeImple.py`: Core implementation of a double-ended queue.