From 84e12385fabc92e992ca86b5912a84b8f3cb9eb2 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 02:20:27 +0000 Subject: [PATCH] Create comprehensive documentation for the repository. - Updated root README.md with Usage and License sections. - Added Tree Representation (List of Lists) to the root README content list. - Created a LICENSE file with the MIT License. - Generated individual README.md files for all major subdirectories: Arrays, Error-debug, GraphAlgorithms, LinkedLists, Queues, Recursion, Sorting, Stacks, Trees, and deque. - Each subdirectory README provides a localized overview and a list of contents. - Verified repository integrity by running all scripts. Co-authored-by: ppant <149585+ppant@users.noreply.github.com> --- Arrays/README.md | 13 +++++++++++++ Error-debug/README.md | 7 +++++++ GraphAlgorithms/README.md | 12 ++++++++++++ LICENSE | 21 +++++++++++++++++++++ LinkedLists/README.md | 11 +++++++++++ Queues/README.md | 8 ++++++++ README.md | 21 +++++++++++++++++++++ Recursion/README.md | 16 ++++++++++++++++ Sorting/README.md | 12 ++++++++++++ Stacks/README.md | 8 ++++++++ Trees/README.md | 16 ++++++++++++++++ deque/README.md | 7 +++++++ 12 files changed, 152 insertions(+) create mode 100644 Arrays/README.md create mode 100644 Error-debug/README.md create mode 100644 GraphAlgorithms/README.md create mode 100644 LICENSE 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..a2b1727 --- /dev/null +++ b/Arrays/README.md @@ -0,0 +1,13 @@ +# Arrays + +This directory contains Python implementations of common array-based algorithms. + +## Contents + +- [Anagram Check](Anagram_Check_Sorted_Sol.py) - Checks if two strings are anagrams of each other (Sorted solution). +- [Anagram Check (Manual)](Anagram_Check_manual_Sol.py) - Checks if two strings are anagrams of each other (Manual frequency count). +- [Array Pair Sum](ArrayPairSumSol.py) - Given an integer array, output all unique pairs that sum up to a specific value `k`. +- [Find Missing Element (XOR)](ArrayFindTheMissingElement_XOR_sol.py) - Find the missing element using XOR. +- [Find Missing Element (Brute Force)](ArrayFindTheMissingElement_brute_force_sol.py) - Find the missing element using brute force. +- [Find Missing Element (Hash Table)](ArrayFindTheMissingElement_hash_table_sol.py) - Find the missing element using a hash table. +- [Find Missing Element (Sum)](ArrayFindTheMissingElement_takingSumandSubtract_sol.py) - Find the missing element by comparing sums. diff --git a/Error-debug/README.md b/Error-debug/README.md new file mode 100644 index 0000000..e92ccaf --- /dev/null +++ b/Error-debug/README.md @@ -0,0 +1,7 @@ +# Error Handling and Debugging + +This directory contains examples of error handling and debugging in Python. + +## Contents + +- [Basic Exception Handling](ErrorExceptions.py) - Demonstrates `try-except-else-finally` blocks and user input validation. diff --git a/GraphAlgorithms/README.md b/GraphAlgorithms/README.md new file mode 100644 index 0000000..77eee90 --- /dev/null +++ b/GraphAlgorithms/README.md @@ -0,0 +1,12 @@ +# Graph Algorithms + +This directory contains Python implementations of common graph algorithms. + +## Contents + +- [Adjacency List Implementation](AdjacencyListGraphImple.py) - Basic graph representation using an adjacency list. +- [Breadth First Search (BFS)](BFS.py) - Breadth First Search implementation, applied to the Word Ladder problem. +- [Word Ladder Problem](WordLadderProblem.py) - Implementation specifically for the Word Ladder problem. +- [Depth First Search (DFS)](DFSGeneral.py) - General implementation of Depth First Search. +- [Knight's Tour Problem (DFS)](TheKnightsTourProblem.py) - Depth First Search implementation for the Knight's Tour problem. +- [Knight's Tour Problem Implementation](DFSImpleTheKnightsTourProblem.py) - Detailed DFS implementation specifically for the Knight's Tour. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94ff0ae --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Pradeep K. Pant + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LinkedLists/README.md b/LinkedLists/README.md new file mode 100644 index 0000000..7798d76 --- /dev/null +++ b/LinkedLists/README.md @@ -0,0 +1,11 @@ +# Linked Lists + +This directory contains Python implementations of common linked list operations and algorithms. + +## Contents + +- [Singly Linked List Implementation](SingleLinkedListImple.py) - Basic skeleton for a Singly Linked List. +- [Doubly Linked List Implementation](DoublyLinkedListImple.py) - Basic skeleton for a Doubly Linked List. +- [Singly Linked List Cycle Check](SinglyLinkedListCycleCheckImple.py) - Check if a singly linked list contains a cycle using the "two runners" (slow and fast pointers) strategy. +- [Reverse a Linked List](LinkedListReversal.py) - Reverse a linked list in-place. +- [Nth to Last Node](LinkedListNthToLastNode.py) - Find the nth to last node in a linked list. diff --git a/Queues/README.md b/Queues/README.md new file mode 100644 index 0000000..dcf0e15 --- /dev/null +++ b/Queues/README.md @@ -0,0 +1,8 @@ +# Queues + +This directory contains Python implementations of queue-based data structures. + +## Contents + +- [Queue Implementation](QueueImple.py) - Basic queue operations (FIFO): `enqueue`, `dequeue`, `isEmpty`, `size`. +- [Queue with Two Stacks](QueueWith2StacksImple.py) - Implement a queue using two stacks. diff --git a/README.md b/README.md index 790acf4..08ae069 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ This repository contains a collection of common programming problems and data st - [Sorting](#sorting) - [Graph Algorithms](#graph-algorithms) - [Error Handling](#error-handling) +- [Usage](#usage) - [Acknowledgments](#acknowledgments) +- [License](#license) --- @@ -149,6 +151,10 @@ Implementing a tree using classes and references. Print a binary tree in level order. - **File**: `Trees/TreeLevelOrderPrintImple.py` +### Tree Representation (List of Lists) +Implementing a tree using list of lists. +- **File**: `Trees/buildTreeTest.py` + --- ## Sorting @@ -204,7 +210,22 @@ Demonstrates `try-except-else-finally` blocks and user input validation. --- +## Usage +Most of the scripts can be run directly using Python 3: + +```bash +python3 path/to/script.py +``` + +For example: +```bash +python3 Arrays/Anagram_Check_Sorted_Sol.py +``` + ## 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) - [Big O Notation - Plain English Explanation](https://stackoverflow.com/questions/487258/what-is-a-plain-english-explanation-of-big-o-notation/487278#487278) + +## License +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/Recursion/README.md b/Recursion/README.md new file mode 100644 index 0000000..640730a --- /dev/null +++ b/Recursion/README.md @@ -0,0 +1,16 @@ +# Recursion + +This directory contains Python implementations of various recursive algorithms. + +## Contents + +- [Cumulative Sum](RecursionCumulativeSum.py) - Compute the cumulative sum from 0 to `n`. +- [Sum of Digits](RecursionSumOfDigits.py) - Returns the sum of all individual digits in an integer. +- [Word Split](RecursionWordSplit.py) - Determine if a string can be split into words found in a given list. +- [Reverse a String](RecursionReverseStr.py) - Recursive implementation to reverse a string. +- [String Permutations](RecursionStrPermutation.py) - Output all possible permutations of a string. +- [Fibonacci Sequence (Iterative)](FibonacciSeqIterative.py) - Iterative Fibonacci implementation. +- [Fibonacci Sequence (Recursive)](FibonacciSeqRecursion.py) - Recursive Fibonacci implementation. +- [Fibonacci Sequence (Dynamic Programming)](FibonacciSeqDynamic.py) - Fibonacci implementation using memoization. +- [Coin Change Problem (Recursion)](CoinChangeProblemRecursion.py) - Find fewest coins needed using simple recursion. +- [Coin Change Problem (Dynamic Programming)](CoinChangeProblemDynamic.py) - Find fewest coins needed using dynamic programming. diff --git a/Sorting/README.md b/Sorting/README.md new file mode 100644 index 0000000..89b9ec2 --- /dev/null +++ b/Sorting/README.md @@ -0,0 +1,12 @@ +# Sorting Algorithms + +This directory contains implementations of various sorting algorithms in Python. + +## Contents + +- [Bubble Sort](BubbleSortImple.py) - Complexity $O(n^2)$ worst and average case, $O(n)$ best case. +- [Selection Sort](SelectionSortImple.py) - Complexity $O(n^2)$ for all cases. +- [Insertion Sort](InsertionSortImple.py) - Complexity $O(n^2)$ worst and average case, $O(n)$ best case. +- [Merge Sort](MergeSortImple.py) - Complexity $O(n \log n)$ for all cases. +- [Quick Sort](QuickSortImple.py) - Complexity $O(n^2)$ worst case, $O(n \log n)$ average/best case. +- [Shell Sort](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..dcde560 --- /dev/null +++ b/Stacks/README.md @@ -0,0 +1,8 @@ +# Stacks + +This directory contains Python implementations of stack-based algorithms. + +## Contents + +- [Stack Implementation](StackImple.py) - Basic stack operations (LIFO): `push`, `pop`, `peek`, `isEmpty`, `size`. +- [Balanced Parentheses Check](BalanceParenthlessCheckImple.py) - Check if a string of opening and closing parentheses is balanced. diff --git a/Trees/README.md b/Trees/README.md new file mode 100644 index 0000000..6c577f8 --- /dev/null +++ b/Trees/README.md @@ -0,0 +1,16 @@ +# Tree Algorithms + +This directory contains Python implementations of common tree algorithms and data structures. + +## Contents + +- [Binary Search Tree Implementation](BinarySearchTreesImple.py) - Basic operations for a Binary Search Tree. +- [Binary Heap Implementation](BinaryHeapImple.py) - Implementation of a Binary Heap. +- [Binary Search](BinarySearchImple.py) - Recursive and iterative binary search. +- [Binary Search (Recursive)](BinarySearchRecursiveImple.py) - Dedicated recursive binary search implementation. +- [Validate BST (Sol 1)](BinarySearchTreeCheckImpleSol1.py) - Check if a binary tree is a valid Binary Search Tree (Sol 1). +- [Validate BST (Sol 2)](BinarySearchTreeCheckImpleSol2.py) - Check if a binary tree is a valid Binary Search Tree (Sol 2). +- [Trim a BST](TrimBinarySearchTreeImple.py) - Trim a BST so all nodes are within a given range `[min, max]`. +- [Tree Representation (Nodes & References)](TreeRepresentationWithNodesReferences.py) - Implementing a tree using classes and references. +- [Tree Level Order Print](TreeLevelOrderPrintImple.py) - Print a binary tree in level order. +- [Tree Representation (List of Lists)](buildTreeTest.py) - Implementing a tree using list of lists. diff --git a/deque/README.md b/deque/README.md new file mode 100644 index 0000000..2513d2a --- /dev/null +++ b/deque/README.md @@ -0,0 +1,7 @@ +# Deque + +This directory contains Python implementations of double-ended queues. + +## Contents + +- [Deque Implementation](DequeImple.py) - Double-ended queue operations: `addFront`, `addRear`, `removeFront`, `removeRear`, `isEmpty`, `size`.