Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions Arrays/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ This directory contains Python implementations of common array-based algorithms

## Contents

- [Anagram Check (Sorted Solution)](Anagram_Check_Sorted_Sol.py): Checks if two strings are anagrams by comparing their sorted versions.
- [Anagram Check (Manual Solution)](Anagram_Check_manual_Sol.py): Checks if two strings are anagrams using a hash table (dictionary) to count character frequencies.
- [Array Find Missing Element (XOR Solution)](ArrayFindTheMissingElement_XOR_sol.py): Efficiently finds a missing element in a shuffled array using bitwise XOR.
- [Array Find Missing Element (Brute Force Solution)](ArrayFindTheMissingElement_brute_force_sol.py): Finds a missing element by sorting both arrays and comparing them.
- [Array Find Missing Element (Hash Table Solution)](ArrayFindTheMissingElement_hash_table_sol.py): Finds a missing element using a hash table (dictionary) to track element counts.
- [Array Find Missing Element (Sum/Subtract Solution)](ArrayFindTheMissingElement_takingSumandSubtract_sol.py): Finds a missing element by calculating the difference between the sums of the two arrays.
- [Array Pair Sum Solution](ArrayPairSumSol.py): Finds all unique pairs in an array that sum up to a specific value $k$ using a set for $O(n)$ complexity.
- [Anagram Check (Sorted Solution)](AnagramCheckSortedSol.py): Checks if two strings are anagrams by comparing their sorted versions. Time Complexity: $O(n \log n)$.
- [Anagram Check (Manual Solution)](AnagramCheckManualSol.py): Checks if two strings are anagrams using a hash table (dictionary) to count character frequencies. Time Complexity: $O(n)$.
- [Array Find Missing Element (XOR Solution)](ArrayFindTheMissingElementXORSol.py): Efficiently finds a missing element in a shuffled array using bitwise XOR. Time Complexity: $O(n)$.
- [Array Find Missing Element (Brute Force Solution)](ArrayFindTheMissingElementBruteForceSol.py): Finds a missing element by sorting both arrays and comparing them. Time Complexity: $O(n \log n)$.
- [Array Find Missing Element (Hash Table Solution)](ArrayFindTheMissingElementHashTableSol.py): Finds a missing element using a hash table (dictionary) to track element counts. Time Complexity: $O(n)$.
- [Array Find Missing Element (Sum/Subtract Solution)](ArrayFindTheMissingElementSumSol.py): Finds a missing element by calculating the difference between the sums of the two arrays. Time Complexity: $O(n)$.
- [Array Pair Sum Solution](ArrayPairSumSol.py): Finds all unique pairs in an array that sum up to a specific value $k$ using a set. Time Complexity: $O(n)$.
File renamed without changes.
13 changes: 13 additions & 0 deletions Deque/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Deque

This directory contains a Python implementation of a Double-Ended Queue (Deque).

## Contents

- [Deque Implementation](DequeImple.py): A class-based implementation of a deque using a Python list.
- `addFront()`: $O(1)$
- `addRear()`: $O(n)$
- `removeFront()`: $O(1)$
- `removeRear()`: $O(n)$
- `isEmpty()`: $O(1)$
- `size()`: $O(1)$
File renamed without changes.
2 changes: 1 addition & 1 deletion Error-debug/README.md → ErrorHandling/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Error and Debugging
# Error Handling

This directory contains examples of error handling and debugging techniques in Python.

Expand Down
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.

## 📖 Table of Contents

- [Getting Started](#getting-started)
- [Project Structure](#project-structure)
- [Data Structures](#data-structures)
- [Arrays](#arrays)
- [Linked Lists](#linked-lists)
- [Stacks](#stacks)
- [Queues](#queues)
- [Deque](#deque)
- [Trees](#trees)
- [Algorithms](#algorithms)
- [Sorting](#sorting)
- [Recursion & Dynamic Programming](#recursion--dynamic-programming)
- [Graph Algorithms](#graph-algorithms)
- [Error Handling & Debugging](#error-handling--debugging)
- [Usage](#usage)
- [Quick Reference](#quick-reference)
- [License](#license)
- [Getting Started](#-getting-started)
- [Project Structure](#-project-structure)
- [Data Structures](#-data-structures)
- [Arrays](#arrays-)
- [Linked Lists](#linked-lists-)
- [Stacks](#stacks-)
- [Queues](#queues-)
- [Deque](#deque-)
- [Trees](#trees-)
- [Algorithms](#-algorithms)
- [Sorting](#sorting-)
- [Recursion & Dynamic Programming](#recursion--dynamic-programming-)
- [Graph Algorithms](#graph-algorithms-)
- [Error Handling & Debugging](#-error-handling--debugging)
- [Usage](#-usage)
- [Quick Reference](#-quick-reference)
- [License](#-license)

---

Expand All @@ -67,7 +67,7 @@ Most scripts in this repository are standalone and can be executed directly:

```bash
# Run any Python script
python3 Arrays/Anagram_Check_Sorted_Sol.py
python3 Arrays/AnagramCheckSortedSol.py

# Or run from the repo root
python3 Sorting/BubbleSortImple.py
Expand All @@ -80,15 +80,15 @@ python3 Sorting/BubbleSortImple.py
```
.
├── Arrays/ # 🔤 Array-based problems and algorithms
├── Error-debug/ # ⚠️ Error handling and debugging examples
├── Deque/ # 🔄 Double-ended queue
├── ErrorHandling/ # ⚠️ Error handling and debugging examples
├── GraphAlgorithms/ # 🗺️ Graph traversal (BFS, DFS) and pathfinding
├── LinkedLists/ # 🔗 Singly and Doubly Linked Lists
├── Queues/ # 📦 Queue implementations (FIFO)
├── Recursion/ # 🔀 Recursive problems and Dynamic Programming
├── Sorting/ # 📊 Common sorting algorithms
├── Stacks/ # 📚 Stack implementations and applications
├── Trees/ # 🌳 Binary Trees, BSTs, Heaps, and Traversals
├── deque/ # 🔄 Double-ended queue
├── CONTRIBUTING.md # 🤝 Contribution guidelines
├── LICENSE # 📄 MIT License
└── README.md # 📖 This file
Expand All @@ -100,9 +100,9 @@ python3 Sorting/BubbleSortImple.py

### Arrays 🔤
Common array-based algorithms and manipulations.
- [Anagram Check](Arrays/): [Sorted](Arrays/Anagram_Check_Sorted_Sol.py) & [Manual](Arrays/Anagram_Check_manual_Sol.py) solutions
- [Anagram Check](Arrays/): [Sorted](Arrays/AnagramCheckSortedSol.py) & [Manual](Arrays/AnagramCheckManualSol.py) solutions
- [Array Pair Sum](Arrays/ArrayPairSumSol.py): Find pairs that sum to $k$
- [Find Missing Element](Arrays/): [XOR](Arrays/ArrayFindTheMissingElement_XOR_sol.py), [Brute Force](Arrays/ArrayFindTheMissingElement_brute_force_sol.py), [Hash Table](Arrays/ArrayFindTheMissingElement_hash_table_sol.py), & [Sum](Arrays/ArrayFindTheMissingElement_takingSumandSubtract_sol.py) approaches
- [Find Missing Element](Arrays/): [XOR](Arrays/ArrayFindTheMissingElementXORSol.py), [Brute Force](Arrays/ArrayFindTheMissingElementBruteForceSol.py), [Hash Table](Arrays/ArrayFindTheMissingElementHashTableSol.py), & [Sum](Arrays/ArrayFindTheMissingElementSumSol.py) approaches

### Linked Lists 🔗
Implementations and problems involving linked structures.
Expand All @@ -123,7 +123,7 @@ FIFO (First-In-First-Out) data structures.

### Deque 🔄
Double-ended queue operations.
- [Deque Implementation](deque/DequeImple.py): Operations at both ends
- [Deque Implementation](Deque/DequeImple.py): Operations at both ends

### Trees 🌳
Hierarchical data structures.
Expand All @@ -133,7 +133,7 @@ Hierarchical data structures.
- [Binary Heap](Trees/BinaryHeapImple.py): Min-heap implementation
- [Tree Traversals](Trees/TreeLevelOrderPrintImple.py): Level order (BFS) printing
- [Trim BST](Trees/TrimBinarySearchTreeImple.py): Keep nodes within a range
- [Tree Representations](Trees/): [Nodes & References](Trees/TreeRepresentationWithNodesReferences.py) & [List of Lists](Trees/buildTreeTest.py)
- [Tree Representations](Trees/): [Nodes & References](Trees/TreeRepresentationWithNodesReferences.py) & [List of Lists](Trees/BuildTreeTest.py)

---

Expand Down Expand Up @@ -168,7 +168,7 @@ Algorithms for graph traversal and pathfinding.

## ⚠️ Error Handling & Debugging

- [Error and Exceptions](Error-debug/ErrorExceptions.py): Demonstrates `try`, `except`, `else`, and `finally` blocks for robust error handling.
- [Error and Exceptions](ErrorHandling/ErrorExceptions.py): Demonstrates `try`, `except`, `else`, and `finally` blocks for robust error handling.

---

Expand Down
File renamed without changes.
27 changes: 10 additions & 17 deletions Trees/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@ This directory contains Python implementations of various tree-based data struct

## Contents

### Binary Search Trees (BST)
- [Binary Search Tree Implementation](BinarySearchTreesImple.py): A comprehensive implementation of a BST with `TreeNode` and `BinarySearchTree` classes, including insertion, deletion, and search.
- [Validate BST (Solution 1)](BinarySearchTreeCheckImpleSol1.py): Validates a BST by performing an in-order traversal and checking if the resulting values are sorted.
- [Validate BST (Solution 2)](BinarySearchTreeCheckImpleSol2.py): Validates a BST by keeping track of the minimum and maximum allowable values for each node.
- [Trim a BST](TrimBinarySearchTreeImple.py): Trims a BST so that all node values fall within a specified range $[min, max]$.

### Search Algorithms
- [Binary Search (Iterative)](BinarySearchImple.py): Iterative implementation of the binary search algorithm on a sorted list.
- [Binary Search (Recursive)](BinarySearchRecursiveImple.py): Recursive implementation of the binary search algorithm.

### Heaps
- [Binary Heap Implementation](BinaryHeapImple.py): Implements a min-heap using a recursive approach, including `insert`, `delMin`, and `buildHeap`.

### Tree Representations & Traversals
- [Nodes and References Representation](TreeRepresentationWithNodesReferences.py): A simple implementation of a binary tree using a class-based nodes and references approach.
- [List of Lists Representation](buildTreeTest.py): Demonstrates building and manipulating a tree using a "list of lists" approach.
- [Tree Level Order Print](TreeLevelOrderPrintImple.py): Prints a binary tree in level order (breadth-first) using a queue, with each level on a new line.
- [Binary Search Tree](BinarySearchTreesImple.py): A complete implementation of a Binary Search Tree (BST) with search and insert operations. Average Time Complexity: $O(\log n)$, Worst-case: $O(n)$.
- [BST Validation (Solution 1)](BinarySearchTreeCheckImpleSol1.py): Validates a BST using an in-order traversal approach. Time Complexity: $O(n)$.
- [BST Validation (Solution 2)](BinarySearchTreeCheckImpleSol2.py): Validates a BST by checking if each node falls within a specific range. Time Complexity: $O(n)$.
- [Binary Search (Iterative)](BinarySearchImple.py): An iterative implementation of the binary search algorithm on a sorted list. Time Complexity: $O(\log n)$.
- [Binary Search (Recursive)](BinarySearchRecursiveImple.py): A recursive implementation of the binary search algorithm on a sorted list. Time Complexity: $O(\log n)$.
- [Binary Heap](BinaryHeapImple.py): Implementation of a Min-Heap. Time Complexity: $O(\log n)$ for insertion and extraction.
- [Tree Level Order Print](TreeLevelOrderPrintImple.py): Implementation of a level-order traversal (BFS) for a binary tree. Time Complexity: $O(n)$.
- [Trim a Binary Search Tree](TrimBinarySearchTreeImple.py): Trims a BST so that all its elements are within a specific range $[min, max]$. Time Complexity: $O(n)$.
- [Tree Representation (Nodes & References)](TreeRepresentationWithNodesReferences.py): Represents a tree using a node class and references to other nodes.
- [Tree Representation (List of Lists)](BuildTreeTest.py): Demonstrates a tree representation using nested Python lists.
7 changes: 0 additions & 7 deletions deque/README.md

This file was deleted.