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
20 changes: 20 additions & 0 deletions Arrays/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Arrays

This directory contains Python implementations of common array-related algorithms and problems.

## Contents

### Anagram Check
Checks if two strings are anagrams of each other.
- [Anagram_Check_Sorted_Sol.py](Anagram_Check_Sorted_Sol.py): Easy and direct solution using sorting.
- [Anagram_Check_manual_Sol.py](Anagram_Check_manual_Sol.py): Manual implementation using a dictionary to count character frequencies.

### Array Pair Sum
- [ArrayPairSumSol.py](ArrayPairSumSol.py): Given an integer array, output all unique pairs that sum up to a specific value `k`.

### Find Missing Element
Find the missing element in a shuffled second array.
- [ArrayFindTheMissingElement_XOR_sol.py](ArrayFindTheMissingElement_XOR_sol.py): Using XOR logic.
- [ArrayFindTheMissingElement_brute_force_sol.py](ArrayFindTheMissingElement_brute_force_sol.py): Brute force approach.
- [ArrayFindTheMissingElement_hash_table_sol.py](ArrayFindTheMissingElement_hash_table_sol.py): Using a hash table/dictionary.
- [ArrayFindTheMissingElement_takingSumandSubtract_sol.py](ArrayFindTheMissingElement_takingSumandSubtract_sol.py): Using the difference of sums.
7 changes: 7 additions & 0 deletions Error-debug/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Error and Exception Handling

This directory contains examples and scripts for handling errors and exceptions in Python.

## Contents

- [ErrorExceptions.py](ErrorExceptions.py): Demonstrates `try-except-else-finally` blocks and common error-handling practices, such as validating user input.
12 changes: 12 additions & 0 deletions GraphAlgorithms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Graph Algorithms

This directory contains implementations of fundamental graph algorithms and their application to specific problems.

## Contents

- [AdjacencyListGraphImple.py](AdjacencyListGraphImple.py): Implementation of an adjacency list graph representation.
- [BFS.py](BFS.py): Breadth-First Search (BFS) implementation.
- [DFSGeneral.py](DFSGeneral.py): A general implementation of Depth-First Search (DFS).
- [TheKnightsTourProblem.py](TheKnightsTourProblem.py): Modeling the Knight's Tour problem as a graph.
- [DFSImpleTheKnightsTourProblem.py](DFSImpleTheKnightsTourProblem.py): Solving the Knight's Tour problem using DFS.
- [WordLadderProblem.py](WordLadderProblem.py): Solving the Word Ladder problem using BFS and graphs.
14 changes: 14 additions & 0 deletions LinkedLists/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Linked Lists

This directory contains implementations of singly and doubly linked list data structures and related algorithms.

## Contents

### Implementations
- [SingleLinkedListImple.py](SingleLinkedListImple.py): Basic skeleton for a Singly Linked List.
- [DoublyLinkedListImple.py](DoublyLinkedListImple.py): Basic skeleton for a Doubly Linked List.

### Algorithms
- [SinglyLinkedListCycleCheckImple.py](SinglyLinkedListCycleCheckImple.py): Check if a singly linked list contains a cycle using the "two runners" (slow and fast pointers) strategy (Floyd's Cycle-Finding Algorithm).
- [LinkedListReversal.py](LinkedListReversal.py): Reverse a linked list in-place.
- [LinkedListNthToLastNode.py](LinkedListNthToLastNode.py): Find the nth to last node in a linked list.
8 changes: 8 additions & 0 deletions Queues/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Queues

This directory contains implementations of queue data structures.

## Contents

- [QueueImple.py](QueueImple.py): Basic queue operations (FIFO): `enqueue`, `dequeue`, `isEmpty`, `size`.
- [QueueWith2StacksImple.py](QueueWith2StacksImple.py): Implementing a queue using two stacks for enqueue and dequeue operations.
21 changes: 21 additions & 0 deletions Recursion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Recursion

This directory contains recursive implementations of common algorithms and mathematical problems.

## Contents

### Basic Recursion
- [RecursionCumulativeSum.py](RecursionCumulativeSum.py): Compute the cumulative sum from 0 to `n`.
- [RecursionSumOfDigits.py](RecursionSumOfDigits.py): Returns the sum of all individual digits in an integer.
- [RecursionWordSplit.py](RecursionWordSplit.py): Determine if a string can be split into words found in a given list.
- [RecursionReverseStr.py](RecursionReverseStr.py): Recursive implementation to reverse a string.
- [RecursionStrPermutation.py](RecursionStrPermutation.py): Output all possible permutations of a string.

### Fibonacci Sequence
- [FibonacciSeqIterative.py](FibonacciSeqIterative.py): Iterative implementation of Fibonacci.
- [FibonacciSeqRecursion.py](FibonacciSeqRecursion.py): Recursive implementation of Fibonacci.
- [FibonacciSeqDynamic.py](FibonacciSeqDynamic.py): Dynamic programming (memoization) implementation of Fibonacci.

### Coin Change Problem
- [CoinChangeProblemRecursion.py](CoinChangeProblemRecursion.py): Recursive implementation.
- [CoinChangeProblemDynamic.py](CoinChangeProblemDynamic.py): Dynamic programming implementation to find the fewest coins needed for change.
12 changes: 12 additions & 0 deletions Sorting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Sorting Algorithms

This directory contains Python implementations of fundamental sorting algorithms and their time complexity analyses.

## Contents

- [BubbleSortImple.py](BubbleSortImple.py): Bubble Sort. Complexity: $O(n^2)$ worst/average case, $O(n)$ best case.
- [SelectionSortImple.py](SelectionSortImple.py): Selection Sort. Complexity: $O(n^2)$ for all cases.
- [InsertionSortImple.py](InsertionSortImple.py): Insertion Sort. Complexity: $O(n^2)$ worst/average case, $O(n)$ best case.
- [MergeSortImple.py](MergeSortImple.py): Merge Sort. Complexity: $O(n \log n)$ for all cases.
- [QuickSortImple.py](QuickSortImple.py): Quick Sort. Complexity: $O(n^2)$ worst case, $O(n \log n)$ average/best case.
- [ShellSortImple.py](ShellSortImple.py): Shell Sort. Complexity: Between $O(n)$ and $O(n^2)$ depending on the increment sequence.
11 changes: 11 additions & 0 deletions Stacks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Stacks

This directory contains implementations of stack data structures and related algorithms.

## Contents

### Implementation
- [StackImple.py](StackImple.py): Basic stack operations (LIFO): `push`, `pop`, `peek`, `isEmpty`, `size`.

### Algorithms
- [BalanceParenthlessCheckImple.py](BalanceParenthlessCheckImple.py): Check if a string of opening and closing parentheses is balanced using a stack.
19 changes: 19 additions & 0 deletions Trees/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Trees

This directory contains implementations of binary trees, heaps, and tree-related search and validation algorithms.

## Contents

### Binary Trees & Heaps
- [BinarySearchTreesImple.py](BinarySearchTreesImple.py): Implementation of a Binary Search Tree (BST).
- [BinaryHeapImple.py](BinaryHeapImple.py): Implementation of a Binary Heap.
- [TreeRepresentationWithNodesReferences.py](TreeRepresentationWithNodesReferences.py): Basic tree structure using nodes and references.
- [buildTreeTest.py](buildTreeTest.py): Building a tree and inserting nodes using a list-of-lists approach.

### Search and Validation
- [BinarySearchImple.py](BinarySearchImple.py): Iterative implementation of Binary Search.
- [BinarySearchRecursiveImple.py](BinarySearchRecursiveImple.py): Recursive implementation of Binary Search.
- [BinarySearchTreeCheckImpleSol1.py](BinarySearchTreeCheckImpleSol1.py): Validating a BST using recursive properties.
- [BinarySearchTreeCheckImpleSol2.py](BinarySearchTreeCheckImpleSol2.py): Validating a BST using in-order traversal logic.
- [TrimBinarySearchTreeImple.py](TrimBinarySearchTreeImple.py): Trimming a BST so all nodes are within a given range `[min, max]`.
- [TreeLevelOrderPrintImple.py](TreeLevelOrderPrintImple.py): Printing a binary tree in level order.
7 changes: 7 additions & 0 deletions deque/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Deque (Double-Ended Queue)

This directory contains the implementation of a deque data structure.

## Contents

- [DequeImple.py](DequeImple.py): Implementation of a double-ended queue, supporting operations: `addFront`, `addRear`, `removeFront`, `removeRear`, `isEmpty`, `size`.