diff --git a/deque/DequeImple.py b/Deque/DequeImple.py similarity index 100% rename from deque/DequeImple.py rename to Deque/DequeImple.py diff --git a/Deque/README.md b/Deque/README.md new file mode 100644 index 0000000..77f2e94 --- /dev/null +++ b/Deque/README.md @@ -0,0 +1,9 @@ +# Deque + +This directory contains Python implementations of the Deque (Double-Ended Queue) data structure. + +## Contents + +- [Deque Implementation](DequeImple.py): Basic implementation of a Deque using a Python list. + - `addFront()` and `removeFront()`: $O(1)$ complexity as they operate on the end of the list. + - `addRear()` and `removeRear()`: $O(n)$ complexity due to list shifting when inserting/popping at index 0. diff --git a/Error-debug/ErrorExceptions.py b/ErrorHandling/ErrorExceptions.py similarity index 100% rename from Error-debug/ErrorExceptions.py rename to ErrorHandling/ErrorExceptions.py diff --git a/Error-debug/README.md b/ErrorHandling/README.md similarity index 92% rename from Error-debug/README.md rename to ErrorHandling/README.md index c8bc4d4..93599e6 100644 --- a/Error-debug/README.md +++ b/ErrorHandling/README.md @@ -1,4 +1,4 @@ -# Error and Debugging +# Error Handling This directory contains examples of error handling and debugging techniques in Python. diff --git a/Queues/README.md b/Queues/README.md index a1c90d0..5875ab7 100644 --- a/Queues/README.md +++ b/Queues/README.md @@ -4,5 +4,7 @@ This directory contains Python implementations of the Queue data structure. ## Contents -- [Queue Implementation](QueueImple.py): Basic implementation of a FIFO (First-In-First-Out) queue using a Python list. Includes `enqueue`, `dequeue`, `isEmpty`, and `size` methods. -- [Queue with Two Stacks](QueueWith2StacksImple.py): Implements a queue using two stacks (represented by Python lists) to achieve FIFO behavior. +- [Queue Implementation](QueueImple.py): Basic implementation of a FIFO (First-In-First-Out) queue using a Python list. + - `enqueue()`: $O(n)$ complexity due to `insert(0)`. + - `dequeue()`: $O(1)$ complexity using `pop()`. +- [Queue with Two Stacks](QueueWith2StacksImple.py): Implements a queue using two stacks to achieve FIFO behavior with $O(1)$ amortized complexity for both `enqueue` and `dequeue`. diff --git a/README.md b/README.md index b8de7d5..633fadd 100644 --- a/README.md +++ b/README.md @@ -38,16 +38,16 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details. - [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) +- [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) + - [Sorting](#sorting-) + - [Recursion & Dynamic Programming](#recursion--dynamic-programming-) + - [Graph Algorithms](#graph-algorithms-) - [Error Handling & Debugging](#error-handling--debugging) - [Usage](#usage) - [Quick Reference](#quick-reference) @@ -80,7 +80,8 @@ 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) @@ -88,7 +89,6 @@ python3 Sorting/BubbleSortImple.py β”œβ”€β”€ 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 @@ -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. @@ -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. --- diff --git a/Stacks/README.md b/Stacks/README.md index e799a74..048e05d 100644 --- a/Stacks/README.md +++ b/Stacks/README.md @@ -4,5 +4,5 @@ This directory contains Python implementations of the Stack data structure and i ## Contents -- [Stack Implementation](StackImple.py): Basic implementation of a LIFO (Last-In-First-Out) stack using a Python list. Includes `push`, `pop`, `peek`, `isEmpty`, and `size` methods. -- [Balanced Parentheses Check](BalanceParenthlessCheckImple.py): Uses a stack to check if a string of opening and closing parentheses (round, square, and curly) is balanced. +- [Stack Implementation](StackImple.py): Basic implementation of a LIFO (Last-In-First-Out) stack using a Python list. All operations (`push`, `pop`, `peek`) are $O(1)$. +- [Balanced Parentheses Check](BalanceParenthlessCheckImple.py): Uses a stack to check if a string of opening and closing parentheses is balanced in $O(n)$ time. diff --git a/deque/README.md b/deque/README.md deleted file mode 100644 index 046a17f..0000000 --- a/deque/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Deque - -This directory contains Python implementations of the Deque (Double-Ended Queue) data structure. - -## Contents - -- [Deque Implementation](DequeImple.py): Basic implementation of a Deque using a Python list. Includes operations like `addFront`, `addRear`, `removeFront`, `removeRear`, `isEmpty`, and `size`.