From 454bc6bf104099994c8dbf789403f85a64246f5b Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 22 Mar 2026 01:41:22 +0000 Subject: [PATCH] Create a comprehensive README and LICENSE structure for the repository. - Updated root README.md with additional file descriptions, Usage, and License sections. - Created a root LICENSE file with the MIT License text. - Created descriptive README.md files for each major subdirectory (Arrays, Error-debug, GraphAlgorithms, LinkedLists, Queues, Recursion, Sorting, Stacks, Trees, and deque). - Verified the changes by executing a sample of scripts to ensure no regressions. Co-authored-by: ppant <149585+ppant@users.noreply.github.com> --- Arrays/README.md | 16 ++++++++++++++++ Error-debug/README.md | 8 ++++++++ GraphAlgorithms/README.md | 13 +++++++++++++ LICENSE | 21 +++++++++++++++++++++ LinkedLists/README.md | 11 +++++++++++ Queues/README.md | 8 ++++++++ README.md | 20 ++++++++++++++++++++ Recursion/README.md | 18 ++++++++++++++++++ Sorting/README.md | 18 ++++++++++++++++++ Stacks/README.md | 8 ++++++++ Trees/README.md | 18 ++++++++++++++++++ deque/README.md | 7 +++++++ 12 files changed, 166 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..adaed12 --- /dev/null +++ b/Arrays/README.md @@ -0,0 +1,16 @@ +# Arrays + +This directory contains Python implementations of common array-based problems. + +## Contents + +- **Anagram Check**: Checks if two strings are anagrams of each other. + - [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`. + - [ArrayPairSumSol.py](ArrayPairSumSol.py) +- **Find Missing Element**: Find the missing element in a shuffled second array. + - [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..b52ae9b --- /dev/null +++ b/Error-debug/README.md @@ -0,0 +1,8 @@ +# Error Handling and Debugging + +This directory demonstrates common error handling and debugging techniques in Python. + +## Contents + +- **Basic Exception Handling**: Demonstrates `try-except-else-finally` blocks and user input validation. + - [ErrorExceptions.py](ErrorExceptions.py) diff --git a/GraphAlgorithms/README.md b/GraphAlgorithms/README.md new file mode 100644 index 0000000..b8ee00d --- /dev/null +++ b/GraphAlgorithms/README.md @@ -0,0 +1,13 @@ +# Graph Algorithms + +This directory contains Python implementations of common graph-based algorithms and data structures. + +## Contents + +- **Adjacency List Implementation**: [AdjacencyListGraphImple.py](AdjacencyListGraphImple.py) +- **Breadth First Search (BFS)**: [BFS.py](BFS.py) +- **Word Ladder Problem**: Using BFS to solve the word ladder problem. [WordLadderProblem.py](WordLadderProblem.py) +- **Depth First Search (DFS)**: + - [DFSImpleTheKnightsTourProblem.py](DFSImpleTheKnightsTourProblem.py) + - [DFSGeneral.py](DFSGeneral.py) +- **Knight's Tour Problem**: [TheKnightsTourProblem.py](TheKnightsTourProblem.py) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cecd15e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 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..5526848 --- /dev/null +++ b/LinkedLists/README.md @@ -0,0 +1,11 @@ +# Linked Lists + +This directory contains Python implementations of common linked list structures and problems. + +## Contents + +- **Singly Linked List Implementation**: Basic skeleton for a Singly Linked List. [SingleLinkedListImple.py](SingleLinkedListImple.py) +- **Doubly Linked List Implementation**: Basic skeleton for a Doubly Linked List. [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. [SinglyLinkedListCycleCheckImple.py](SinglyLinkedListCycleCheckImple.py) +- **Reverse a Linked List**: Reverse a linked list in-place. [LinkedListReversal.py](LinkedListReversal.py) +- **Nth to Last Node**: Find the nth to last node in a linked list. [LinkedListNthToLastNode.py](LinkedListNthToLastNode.py) diff --git a/Queues/README.md b/Queues/README.md new file mode 100644 index 0000000..2403a0c --- /dev/null +++ b/Queues/README.md @@ -0,0 +1,8 @@ +# Queues + +This directory contains Python implementations of common queue-based data structures. + +## Contents + +- **Queue Implementation**: Basic queue operations (FIFO): `enqueue`, `dequeue`, `isEmpty`, `size`. [QueueImple.py](QueueImple.py) +- **Queue with Two Stacks**: Implement a queue using two stacks. [QueueWith2StacksImple.py](QueueWith2StacksImple.py) diff --git a/README.md b/README.md index 790acf4..9e9e2f0 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) --- @@ -149,6 +151,10 @@ Implementing a tree using classes and references. Print a binary tree in level order. - **File**: `Trees/TreeLevelOrderPrintImple.py` +### Build Tree Test +Demonstrates building a tree and manipulating nodes using a list-of-lists approach. +- **File**: `Trees/buildTreeTest.py` + --- ## Sorting @@ -204,6 +210,20 @@ Demonstrates `try-except-else-finally` blocks and user input validation. --- +## Usage +Most scripts in this repository are standalone and can be executed directly using Python 3. For example: + +```bash +python3 Arrays/ArrayPairSumSol.py +``` + +--- + +## License +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +--- + ## 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..c6f4d93 --- /dev/null +++ b/Recursion/README.md @@ -0,0 +1,18 @@ +# Recursion + +This directory contains Python implementations of common recursive algorithms and problems. + +## Contents + +- **Cumulative Sum**: Compute the cumulative sum from 0 to `n`. [RecursionCumulativeSum.py](RecursionCumulativeSum.py) +- **Sum of Digits**: Returns the sum of all individual digits in an integer. [RecursionSumOfDigits.py](RecursionSumOfDigits.py) +- **Word Split**: Determine if a string can be split into words found in a given list. [RecursionWordSplit.py](RecursionWordSplit.py) +- **Reverse a String**: Recursive implementation to reverse a string. [RecursionReverseStr.py](RecursionReverseStr.py) +- **String Permutations**: Output all possible permutations of a string. [RecursionStrPermutation.py](RecursionStrPermutation.py) +- **Fibonacci Sequence**: Implementations using iteration, recursion, and dynamic programming (memoization). + - [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. + - [CoinChangeProblemRecursion.py](CoinChangeProblemRecursion.py) + - [CoinChangeProblemDynamic.py](CoinChangeProblemDynamic.py) diff --git a/Sorting/README.md b/Sorting/README.md new file mode 100644 index 0000000..baef599 --- /dev/null +++ b/Sorting/README.md @@ -0,0 +1,18 @@ +# Sorting + +This directory contains Python implementations of common sorting algorithms. + +## Contents + +- **Bubble Sort**: [BubbleSortImple.py](BubbleSortImple.py) + - Complexity: O(n²) worst/average, O(n) best. +- **Selection Sort**: [SelectionSortImple.py](SelectionSortImple.py) + - Complexity: O(n²) for all cases. +- **Insertion Sort**: [InsertionSortImple.py](InsertionSortImple.py) + - Complexity: O(n²) worst/average, O(n) best. +- **Merge Sort**: [MergeSortImple.py](MergeSortImple.py) + - Complexity: O(n log n) for all cases. +- **Quick Sort**: [QuickSortImple.py](QuickSortImple.py) + - Complexity: O(n²) worst, O(n log n) average/best. +- **Shell Sort**: [ShellSortImple.py](ShellSortImple.py) + - Complexity: Between O(n) and O(n²) depending on increment sequence. diff --git a/Stacks/README.md b/Stacks/README.md new file mode 100644 index 0000000..56d848b --- /dev/null +++ b/Stacks/README.md @@ -0,0 +1,8 @@ +# Stacks + +This directory contains Python implementations of common stack-based data structures and problems. + +## Contents + +- **Stack Implementation**: Basic stack operations (LIFO): `push`, `pop`, `peek`, `isEmpty`, `size`. [StackImple.py](StackImple.py) +- **Balanced Parentheses Check**: Check if a string of opening and closing parentheses is balanced. [BalanceParenthlessCheckImple.py](BalanceParenthlessCheckImple.py) diff --git a/Trees/README.md b/Trees/README.md new file mode 100644 index 0000000..d66b07b --- /dev/null +++ b/Trees/README.md @@ -0,0 +1,18 @@ +# Trees + +This directory contains Python implementations of common tree-based data structures and algorithms. + +## Contents + +- **Binary Search Tree Implementation**: [BinarySearchTreesImple.py](BinarySearchTreesImple.py) +- **Binary Heap Implementation**: [BinaryHeapImple.py](BinaryHeapImple.py) +- **Binary Search**: Recursive and iterative implementations. + - [BinarySearchImple.py](BinarySearchImple.py) + - [BinarySearchRecursiveImple.py](BinarySearchRecursiveImple.py) +- **Validate BST**: Check if a binary tree is a valid Binary Search Tree. + - [BinarySearchTreeCheckImpleSol1.py](BinarySearchTreeCheckImpleSol1.py) + - [BinarySearchTreeCheckImpleSol2.py](BinarySearchTreeCheckImpleSol2.py) +- **Trim a BST**: Trim a BST so all nodes are within a given range [min, max]. [TrimBinarySearchTreeImple.py](TrimBinarySearchTreeImple.py) +- **Tree Representation (Nodes & References)**: Implementing a tree using classes and references. [TreeRepresentationWithNodesReferences.py](TreeRepresentationWithNodesReferences.py) +- **Tree Level Order Print**: Print a binary tree in level order. [TreeLevelOrderPrintImple.py](TreeLevelOrderPrintImple.py) +- **Build Tree Test**: Demonstrates building a tree and manipulating nodes using a list-of-lists approach. [buildTreeTest.py](buildTreeTest.py) diff --git a/deque/README.md b/deque/README.md new file mode 100644 index 0000000..53ebb2e --- /dev/null +++ b/deque/README.md @@ -0,0 +1,7 @@ +# Deque + +This directory contains a Python implementation of the Deque data structure. + +## Contents + +- **Deque Implementation**: Double-ended queue operations: `addFront`, `addRear`, `removeFront`, `removeRear`, `isEmpty`, `size`. [DequeImple.py](DequeImple.py)