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

This directory contains implementations of array-based algorithms and common interview problems.

## Contents

### Anagram Check
- `Anagram_Check_Sorted_Sol.py`: Solution using sorting.
- `Anagram_Check_manual_Sol.py`: Manual solution using a frequency dictionary.

### Array Pair Sum
- `ArrayPairSumSol.py`: Finds all unique pairs in an array that sum to a specific value.

### Find Missing Element
- `ArrayFindTheMissingElement_XOR_sol.py`: Efficient solution using XOR.
- `ArrayFindTheMissingElement_brute_force_sol.py`: Simple brute force approach.
- `ArrayFindTheMissingElement_hash_table_sol.py`: Solution using a hash table for O(n) complexity.
- `ArrayFindTheMissingElement_takingSumandSubtract_sol.py`: Mathematical approach using sums.
8 changes: 8 additions & 0 deletions Error-debug/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Error and Debugging

This directory contains examples and scripts related to error handling and debugging in Python.

## Contents

### Basic Exception Handling
- `ErrorExceptions.py`: Demonstrates the use of `try`, `except`, `else`, and `finally` blocks for robust error management and user input validation.
17 changes: 17 additions & 0 deletions GraphAlgorithms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Graph Algorithms

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

## Contents

### Adjacency List
- `AdjacencyListGraphImple.py`: Core implementation of a graph using an adjacency list.

### Breadth First Search (BFS)
- `BFS.py`: Standard implementation of BFS.
- `WordLadderProblem.py`: Application of BFS to solve the Word Ladder problem.

### Depth First Search (DFS)
- `DFSGeneral.py`: A generalized implementation of DFS.
- `DFSImpleTheKnightsTourProblem.py`: DFS used in the Knight's Tour problem.
- `TheKnightsTourProblem.py`: Complete implementation for solving the Knight's Tour problem.
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 common algorithms.

## Contents

### Singly Linked List
- `SingleLinkedListImple.py`: Core implementation of a singly linked list.
- `SinglyLinkedListCycleCheckImple.py`: Algorithm to detect cycles in a linked list.
- `LinkedListReversal.py`: In-place reversal of a linked list.
- `LinkedListNthToLastNode.py`: Efficiently find the nth to last node.

### Doubly Linked List
- `DoublyLinkedListImple.py`: Core implementation of a doubly linked list.
11 changes: 11 additions & 0 deletions Queues/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Queues

This directory contains implementations of basic queues and specialized queue-based algorithms.

## Contents

### Standard Queue
- `QueueImple.py`: Core implementation of a queue using the FIFO principle.

### Queue using Two Stacks
- `QueueWith2StacksImple.py`: Innovative implementation of a queue using two stacks.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

---
Expand Down Expand Up @@ -145,6 +147,10 @@ Trim a BST so all nodes are within a given range `[min, max]`.
Implementing a tree using classes and references.
- **File**: `Trees/TreeRepresentationWithNodesReferences.py`

### Tree Representation (List of Lists)
Implementing a tree using a list of lists approach.
- **File**: `Trees/buildTreeTest.py`

### Tree Level Order Print
Print a binary tree in level order.
- **File**: `Trees/TreeLevelOrderPrintImple.py`
Expand Down Expand Up @@ -204,6 +210,20 @@ Demonstrates `try-except-else-finally` blocks and user input validation.

---

## Usage
Most scripts in this repository are standalone Python files and can be executed directly using the Python 3 interpreter.
```bash
python3 path/to/script.py
```

---

## License
This project is licensed under the MIT License.
Copyright (c) 2017 Pradeep K. Pant.

---

## 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)
Expand Down
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 implementations of recursive and dynamic programming algorithms.

## Contents

### Basic Recursion
- `RecursionCumulativeSum.py`: Calculates the cumulative sum from 0 to n recursively.
- `RecursionSumOfDigits.py`: Recursive sum of individual digits in an integer.
- `RecursionWordSplit.py`: Determining if a string can be split into valid words.
- `RecursionReverseStr.py`: Recursive implementation to reverse a string.

### Permutations and Sequences
- `RecursionStrPermutation.py`: Generates all possible permutations of a string.
- `FibonacciSeqIterative.py`: Iterative solution for the Fibonacci sequence.
- `FibonacciSeqRecursion.py`: Simple recursive solution for the Fibonacci sequence.
- `FibonacciSeqDynamic.py`: Optimized Fibonacci solution using dynamic programming (memoization).

### Coin Change Problem
- `CoinChangeProblemRecursion.py`: Recursive solution to find the minimum number of coins for change.
- `CoinChangeProblemDynamic.py`: Optimized dynamic programming solution for the coin change problem.
13 changes: 13 additions & 0 deletions Sorting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Sorting

This directory contains implementations of various sorting algorithms with their time complexity details.

## Contents

### Standard Sorting Algorithms
- `BubbleSortImple.py`: Core implementation of the Bubble Sort algorithm.
- `SelectionSortImple.py`: Core implementation of the Selection Sort algorithm.
- `InsertionSortImple.py`: Core implementation of the Insertion Sort algorithm.
- `MergeSortImple.py`: Core implementation of the Merge Sort algorithm.
- `QuickSortImple.py`: Core implementation of the Quick Sort algorithm.
- `ShellSortImple.py`: Core implementation of the Shell Sort algorithm.
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 stacks and related interview problems.

## Contents

### Standard Stack
- `StackImple.py`: Core implementation of a stack following the LIFO principle.

### Balanced Parentheses Check
- `BalanceParenthlessCheckImple.py`: Algorithm to verify balanced opening and closing parentheses.
21 changes: 21 additions & 0 deletions Trees/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Trees

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

## Contents

### Binary Search Trees
- `BinarySearchTreesImple.py`: Core implementation of a binary search tree.
- `BinarySearchTreeCheckImpleSol1.py`: Validation check for binary search trees (Solution 1).
- `BinarySearchTreeCheckImpleSol2.py`: Validation check for binary search trees (Solution 2).
- `TrimBinarySearchTreeImple.py`: Algorithm to trim a binary search tree within a given range.

### Search and Heaps
- `BinarySearchImple.py`: Iterative implementation of a binary search algorithm.
- `BinarySearchRecursiveImple.py`: Recursive implementation of a binary search algorithm.
- `BinaryHeapImple.py`: Core implementation of a binary heap.

### Tree Representation and Printing
- `TreeRepresentationWithNodesReferences.py`: Implementation of a tree using a class-based node-and-reference model.
- `buildTreeTest.py`: Implementation of a tree using a list-of-lists approach.
- `TreeLevelOrderPrintImple.py`: Algorithm for level-order traversal and printing of a binary tree.
8 changes: 8 additions & 0 deletions deque/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Deque

This directory contains implementations of a double-ended queue.

## Contents

### Standard Deque
- `DequeImple.py`: Core implementation of a double-ended queue.