AlgoTree
Home
Algorithms
Sorting Algorithms
Merge Sort
QuickSort
Binary Search
Searching a number in a 2D Sorted Matrix
Binary Search : Counting Duplicates 🤡 🤡
Binary Search : Finding Square Root √
Smallest Number In A Rotated Sorted Array
Search Number In A Rotated Sorted Array ↻
Binary Search : Allocate books 📚
Binary Search : Ship packages 🚢
Range Minimum Queries ( RMQ ) : Sparse Table
Binary Indexed Tree ( Fenwick Tree ) 🗂
Adjacency Lists
[ C++ ] : Storing Graph As An Adjacency List
[ Java ] : Storing Graph As An Adjacency List
[ Python ] : Storing Graph As An Adjacency List
Tree & Graph Traversals
Pre-Order, In-Order & Post-Order Traversals
In-Order & Pre-Order : Construct Binary Tree
In-Order & Post-Order : Construct Binary Tree
Level Order Tree Traversal
Right View Of A Binary Tree 🌲 ←
Level Order : Sum Of The Deepest Leaves
Top View Of A Binary Tree
Balance Binary Search Tree ⚖
Level Order : Minimum Depth Of A Binary Tree
Breadth First Search ( BFS )
BFS : Finding Max Area Of An Island
BFS : Finding The Number Of Islands 🏝 🏝
Depth First Search ( DFS )
DFS : Finding Longest Path In A Tree
DFS : All Paths In A Directed Acyclic Graph
DFS : Detecting Cycle In A Directed Graph ➰
DFS : Detecting Cycle In An Undirected Graph
Topological Sort
[ C++ ] : Lexical Topological Sort
[ Python ] : Lexical Topological Sort
Finding A Binary Subtree In A Tree
Finding Diameter of a Binary Tree
Deleting Leaf Nodes In A Binary Tree
Merging Binary Trees
Binary Search Tree
Searching A Binary Search Tree
Validating A Binary Search Tree
Inserting Into A Binary Search Tree
Height-Balanced Tree Check Using Recursion
Height-Balanced Tree Check Using Traversal
Heap
[ C++ ] : Max & Min Heap ( Priority Queue / Set )
[ Python ] : Max & Min Heap ( HeapQ )
K Most Frequent Elements In An Array
K'th largest and smallest element in an array
Merge K Sorted Linked Lists
LRU ( Least Recently Used ) Cache
Stack
Expression Conversion : Infix To Postfix
Evaluating An Infix Expression
Largest Rectangle In A Histogram 📊
Max Size 1 Filled Rectangle In A Binary Matrix
Stock Span Problem 📈
Longest Valid Parentheses
Hash Table & Set
LFU ( Least Frequently Used ) Cache
Finding Anagrams
Grouping Anagrams
Longest Substring w/o Repeating Characters
Linked List 🔗🔗🔗🔗
Singly Linked List : Insert & Append
Singly Linked List : Reverse
Singly Linked List : Detect Cycle
Singly Linked List : Remove Duplicates
Doubly Linked List : Insert, Append & Delete
Backtracking
N Queens problem ♛ ♛ ♛ ♛ ♛ ♛ ♛ ♛
Backtracking + DFS : A Game Of Boggle
Letter Phone 📱
Generating Integer Partitions
Partition N Elements Into K Non-Empty Subsets
Palindrome Partitioning
Break a string into a given set of words
Word Search
Greedy
Light Bulbs 💡 💡 💡 💡 💡
Disjoint-Set : Union By Rank, Path Compression
Lowest Common Ancestor ( LCA )
Finding The LCA Using Recursion
Finding The LCA Using Upward Traversals
Finding The LCA By Moving Level Up And Closer
Minimum Spanning Tree Algorithms
[ Python ] : Prim's Minimum Spanning Tree
[ Java ] : Prim's Minimum Spanning Tree
[ C++ ] : Prim's Minimum Spanning Tree
Kruskal's Minimum Spanning Tree
Single Source Shortest Path Algorithms
[ Python ] : Dijkstra's Shortest Path
[ C++ ] : Dijkstra's Shortest Path
[ Java ] : Dijkstra's Shortest Path
Bellman-Ford's Shortest Path Algorithm
Bellman Ford's Algorithm For DAG
All Pairs Shortest Path : Floyd-Warshall
Numeric 🔢
Fibonacci Sequence 🧬
Euler's Totient Function
Prime Sieve : Generating Prime Numbers
Prime Factors
Euclid's : Finding The Greatest Common Divisor
Factorials Of Large Numbers !
Fast Exponentiation
Modular Multiplication & Exponentiation
Prime Or Non Prime ( Miller-Rabin )
Pythagorean Triples 📐
Pythagorean Triples In An Array 📐
Binomial Coefficents
Subsets / Combinations : Bitwise
Subsets Using Permutations
Integer To Hexadecimal Conversion
Matrix Multiplication
Sudoku
Validate A Given Sudoku
Computational Geometry
Line Segment Intersection
Bitwise Operations
Number Of Set Bits In An Integer
Toggle Last Set Bit
Swapping Integers Using Bitwise XOR
Binary To Decimal Conversion
Recursive Algorithms 🌀 🌀 🌀
Recursive : Finding the N'th Fibonacci number
Recursive : Generating Permutations
Recursive : Generating Subsets / Combinations
Recursive : Dollar sack 💰💰💰
Recursive : Generating Subsequences
Recursive : Generating All Balanced Parenthesis
Recursive : Tower Of Hanoi 🗼
Recursive : Finding Max Depth Of A Binary Tree
Dynamic Programming
Longest Common Subsequence 🧬
Longest Increasing Subsequence 🧬
Distinct Subsequences 🧬
Matrix Chain Multiplication ⛓ ❌ ⛓ ❌ ⛓
Finding Longest Palindromic Substring
Minimum Cuts To Make A Palindrome ✂ ✂
Word Break
String Interleave
0-1 Knapsack Problem 💰
Coins Change Problem 🪙
Minimum Coins For Making Change 💵 🪙
Integer Partitioning Problem
Subset Sum Problem ⊆
Maximum Product Subarray Problem
Maximum Sum Subarray Problem
Finding Size Of Biggest 1 Filled Square
Maximum Sum SubRectangle
Using Aggregate Rectangles
Applying Kadane's Algorithm On Row Sums
Unique Paths In A Grid ▦
Egg Drop Problem 🥚
Assignment Problem Using BitMask
Edit Distance
Climbing Stairs Problem 🪜
KMP Pattern Match Algorithm
Minimum Steps To Make Two Strings Anagrams
Trie [ Python ] [ Java ]
Trie [ C++ ]
Counting Distinct Substrings
Solving Boggle Using Trie & Depth First Search
Rubix Cube
Solving a 2 x 2 Rubix Cube 💠
Solving a 3 x 3 Rubix Cube
A Pinch Of Code
Java : List - Create & Initialize
Java : List Of Arrays
Python : Create A Dictionary From A List
Python : Sort Dictionary By Value & Key
Python : Delete Key & Value from Dictionary
Python : Merge Dictionaries
Python : Two dimensional list.
Python : Convert List Of Strings To List Of Int
Python : Getting Current Date & Time
Python : Decorators
Python : Reading JSON file
Python : Agrument Parser
Python : First & Last N Characters Of A String
Go : Check If File Exists
Go : Read File Line By Line
Go : Extract Pattern Using Regular Expression
Go : Check If A Key Exists In A Map ( Dict )
Go : Remove / Hide fields from a struct
C++ : Compilation Process
C++ : String conversion upper / lower case
C++ : Convert String Of Integers Into A Vector
C++ : Static Keyword
C++ : Copy Constructor
C++ : Lvaule and Rvalue
C++ : Move Constructor
C++ : Overload Assignment (=) Operator
C++ : Move Assignment Operator
C++ : Overload Subscript ( [ ] ) Operator
C++ : Member Initializer List
C++ : Singleton Design Pattern
C++ : Templates
C++ : static_cast & dynamic_cast
C++ : const_cast & reinterpret_cast
C++ : Throwing Exceptions From A Destructor
C++ : Lambda Expression & Callback Functions
C++ : Smart Pointers ( unique, shared, weak )
C++ : Initializing A Vector
C++ : Threads ( Producer & Consumer )
C++ : Threads & Condition Variable 🧵
C++ & Boost : Program Options
C++ & Boost : Parsing XML
C++ & Boost : Generating UUID
JavaScript : Remove An Item From An Array
JavaScript : Accept Only A Numeric Input
JavaScript : Extract Numbers From String
About
Algotree
>
Tags
> C++
tag :: C++
C++ : Adjacency list implementation for storing graph
C++ : Max Heap / Min Heap Using Priority Queue & Set
Counting the number of set bits in an integer
Finding maximum area of an island
Finding The Longest path in a tree using DFS
Finding the N'th number in the Fibonacci sequence
Finding the number of islands
Generating Fibonacci Sequence
Line Segment Intersection
Merge Sort
Minimum Light Bulbs Needed To Light The Whole Corridor
Searching A Node In Binary Search Tree
Singly Linked List : Inserting, Appending and Freeing nodes.
Solving N Queens Problem Using Backtracking
Validate a given Sudoku
All paths in a directed acyclic graph
Boggle
Detecting cycle in directed graphs using Depth-First-Search (DFS)
Generating permutations using recursion
QuickSort Algorithm
Reversing a singly linked list
Toggle last set bit in an integer
Validating A Binary Search Tree (BST)
Detecting a cycle in a singly linked list
Detecting cycle in an undirected graphs using Depth-First-Search (DFS)
Generating subsets or combinations using recursion
Inserting Into A Binary Search Tree
Letter Phone
Prim's Minimum Spanning Tree Algorithm in C++
Finding the value of a dollar sack
Generating all subsequences using recursion
Generating integer partitions using backtracing & recursion
Kruskal's Minimum Spanning Tree Algorithm
LFU Cache
Partition [N] elements into [K] non-empty subsets
Partition A String Into Set(s) Of All Palindromic substrings
Singly Linked List : Remove Duplicates
Breaking a string into a given set of words
Euler's Totient Function
Finding the K most frequent elements in an array
Generating All Combinations Of Balanced Parenthesis
Search a word in a given 2 dimensional matrix of letters
Algorithm for Solving Tower Of Hanoi
Doubly Linked List : Insert, Append and Delete
Finding the maximum depth of a binary tree
Binary Search
Searching a number in a 2D Sorted Matrix
Counting Distinct Substrings In A Given String Using Trie
Algorithm : Infix To Postfix Conversion
Dijkstra's Algorithm in C++
Finding count of duplicate numbers in a sorted array
Finding LCA in a binary tree using Recursion
Finding the k'th largest and smallest element in an array
Longest Common Subsequence
Maximum sum subrectangle
Prime Sieve Algorithm ( Sieve of Eratosthenes )
Range Minimum Queries Using A Sparse Table
Solving Boggle Using Trie
Algorithm : Evaluating an infix expression
Binary Indexed Tree / Fenwick Tree
Finding Prime Factors Of A Number
Finding the Largest Area Rectangle In A Histogram
Finding the area of the largest rectangle in a binary matrix
Stock Span Problem
Longest Valid Parentheses Using Stack
Bellman-Ford Shortest Path Algorithm
Euclidean algorithm
Finding LCA in a binary tree / multinode tree using upward traversals
Finding Longest Increasing SubSequence (LIS)
Maximum sum subrectangle using Kadane's algorithm
Merge K sorted linked lists.
Square Root using Binary Search
Swapping Integers Using XOR operation
Distinct Subsequences
Implementing LRU Cache
Finding factorials of large numbers
Preorder, Inorder and Postorder tree traversals
Construct a binary tree from InOrder & PreOrder traversals
Construct a binary tree from an InOrder & PostOrder traversals
Level order tree traversal
Right View Of A Binary Tree
Sum of leaf nodes at the deepest level
Top View Of A Binary Tree
Balance Binary Search Tree
Finding the minimum depth of a binary tree
Bellman Ford Algorithm for DAG
Binary to decimal conversion
Breadth First Search ( BFS ) Algorithm
Disjoint-Set, Union By Rank & Path Compression
Fast Exponentiation
Finding LCA in a binary / multinode tree
Finding the Smallest number in a rotated sorted array
Matrix Chain Multiplication Using Dynamic Programming
Doing Multiplication & Exponentiation Under Modulo
Longest Palindromic Substring
Checking if a number is prime or non prime
Minimum cuts needed to make a string palindrome
Breaking a string into a given set of words
String Interleave
0-1 Knapsack Problem
Coins Change Problem
Generating Pythagorean Triples
Minimum coins for a change
Search number in a rotated sorted array
Finding Pythagorean Triples
Integer Partitioning Problem
Subset Sum Problem
Binary Search : Allocate books
Binary Search : Ship packages
Algorithm For Finding Binomial Coefficents
Depth First Search ( DFS ) Algorithm
Finding the maximum product of a subarray in an array
Finding the maximum sum of a subarray in an array
Finding All Unique Paths From Top-Left To Bottom-Right Corner
Generating combinations (subsets) using bitwise operations
Topological Sort
Egg Drop Problem
Assignment Problem Using BitMask
Edit Distance
Climbing Stairs
Generating subsets (combinations) using permutations
Topological Sort (Lexical ordering)
Check If A binary tree is a subtree in another binary tree (supertree)
Converting an integer to hexadecimal
Finding the diameter of a binary tree
Deleting Leaf Nodes In A Binary Tree
Matrix Multiplication
Merging Binary Trees
Recursiverly check if a binary tree is height-balanced
Check if a binary tree is height-balanced using tree-traversal
Floyd-Warshall Shortest Path Algorithm
KMP Pattern Match Algorithm
Algorithm For Grouping Anagrams
Minimum Steps Needed To Make Two Strings Of Equal Length Anagrams
Longest substring without repeating characters
Trie in C++
C++ : Compilation Process
C++ : String conversion to uppercase or lowercase
C++ : Parsing a string of integers into an integer array / vector
C++ : static keyword
C++ : Copy Constructor
C++ : Lvaule and Rvalue
C++ : Move Constructor
C++ : Overload Assignment (=) operator
C++ : Move Assignment Operator
C++ : Overload Subscript [ ] operator
C++ : Member Initializer List
C++ : Singleton Design Pattern
C++ : Templates
C++ : static_cast and dynamic_cast
C++ : const_cast and reinterpret_cast
C++ : Throwing Exceptions From A Destructor
C++ : Lambda Expression And Callback Functions
C++ : Smart Pointers
C++ : Vector Initialization
C++ : Producer / Consumer Using Threads, Mutexes and Condition Variables
C++ : Sequential Thread Execution Using Condition Variables
C++ : Using Boost Program Options (Positional Options)
C++ : Parsing XML using Boost
C++ & Boost : Generating UUID