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)$ due to sorting.
- [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.
2 changes: 1 addition & 1 deletion deque/README.md → Deque/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This directory contains Python implementations of the Deque (Double-Ended Queue)

## Contents

- [Deque Implementation](DequeImple.py): Basic implementation of a Deque using a Python list. Includes operations like `addFront`, `addRear`, `removeFront`, `removeRear`, `isEmpty`, and `size`.
- [Deque Implementation](DequeImple.py): Basic implementation of a Deque using a Python list. Includes operations like `addFront` ($O(1)$), `addRear` ($O(n)$), `removeFront` ($O(1)$), `removeRear` ($O(n)$), `isEmpty` ($O(1)$), and `size` ($O(1)$).
7 changes: 0 additions & 7 deletions Error-debug/README.md

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions ErrorHandling/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Error Handling

This directory contains examples of error handling and exception management in Python.

## Contents

- [Error and Exceptions](ErrorExceptions.py): Demonstrates `try`, `except`, `else`, and `finally` blocks for robust error handling.
14 changes: 7 additions & 7 deletions GraphAlgorithms/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Graph Algorithms

This directory contains Python implementations of common graph-based algorithms and data structures.
This directory contains Python implementations of graph-based algorithms and data structures.

## Contents

- [Adjacency List Implementation](AdjacencyListGraphImple.py): Implements the Graph Abstract Data Type (ADT) using an adjacency list (dictionaries in Python). Includes `Vertex` and `Graph` classes.
- [Breadth First Search (BFS)](BFS.py): Implements BFS to solve the Word Ladder problem, finding the shortest transformation path between words.
- [General Depth First Search (DFS)](DFSGeneral.py): Provides a general implementation of DFS, including discovery and finish times for vertices.
- [DFS - Knight's Tour Problem](DFSImpleTheKnightsTourProblem.py): Another implementation of DFS specifically tailored to the Knight's Tour puzzle.
- [The Knight's Tour Problem](TheKnightsTourProblem.py): Focuses on generating the knight's move graph and solving the tour using DFS and backtracking.
- [Word Ladder Problem](WordLadderProblem.py): Specifically focuses on building the word ladder graph where edges connect words that differ by only one letter.
- [Adjacency List](AdjacencyListGraphImple.py): Graph Abstract Data Type implementation using an adjacency list. $O(V+E)$ complexity for most operations.
- [Breadth First Search (BFS)](BFS.py): Implementation of BFS to solve the Word Ladder problem. $O(V+E)$ complexity.
- [Depth First Search (DFS) General](DFSGeneral.py): General implementation of the DFS algorithm. $O(V+E)$ complexity.
- [Knight's Tour Problem (Graph Generation)](TheKnightsTourProblem.py): Generating the graph representation for the Knight's Tour problem.
- [Knight's Tour Problem (DFS Solution)](DFSImpleTheKnightsTourProblem.py): Solving the Knight's Tour problem using DFS. $O(k^N)$ complexity.
- [Word Ladder Problem](WordLadderProblem.py): Building the word ladder graph. $O(V+E)$ complexity.
12 changes: 6 additions & 6 deletions LinkedLists/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Linked Lists

This directory contains Python implementations of various types of linked lists and related algorithms.
This directory contains Python implementations of various types of linked lists and related problems.

## Contents

- [Singly Linked List Implementation](SingleLinkedListImple.py): Basic implementation of a singly linked list node and basic linkage.
- [Doubly Linked List Implementation](DoublyLinkedListImple.py): Basic implementation of a doubly linked list node with `prev` and `next` pointers.
- [Singly Linked List Cycle Check](SinglyLinkedListCycleCheckImple.py): Implements Floyd's Cycle-Finding Algorithm (two pointers) to detect cycles in a linked list.
- [Linked List Reversal](LinkedListReversal.py): Reverses a singly linked list in-place in $O(n)$ time.
- [Nth to Last Node](LinkedListNthToLastNode.py): Finds the $n$-th to last node in a singly linked list using two pointers.
- [Singly Linked List](SinglyLinkedListImple.py): Basic implementation of a singly linked list. $O(1)$ for node linkage.
- [Doubly Linked List](DoublyLinkedListImple.py): Basic implementation of a doubly linked list. $O(1)$ for node linkage.
- [Singly Linked List Cycle Check](SinglyLinkedListCycleCheckImple.py): Implementation of Floyd's cycle-finding algorithm. $O(n)$ complexity.
- [Linked List Reversal](LinkedListReversal.py): In-place reversal of a linked list. $O(n)$ complexity.
- [Linked List Nth to Last Node](LinkedListNthToLastNode.py): Finding the $n$-th node from the end of a linked list. $O(n)$ complexity.
8 changes: 4 additions & 4 deletions LinkedLists/SinglyLinkedListCycleCheckImple.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def __init__(self, value):
self.value = value
self.nextnode = None

def cycle_check(node):
# Set two pointers initialize to passed node
pt1 = node
pt2 = node
def cycle_check(self):
# Set two pointers initialize to self
pt1 = self
pt2 = self
# loop through end of the list
while pt2 != None and pt2.nextnode != None:
pt1 = pt1.nextnode
Expand Down
4 changes: 2 additions & 2 deletions Queues/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ 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 Queue using a Python list. `enqueue` is $O(n)$, `dequeue` is $O(1)$.
- [Queue with Two Stacks](QueueWith2StacksImple.py): Implementation of a Queue using two stacks. $O(1)$ amortized time for operations.
Loading