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
> Java
tag :: Java
Finding The Longest path in a tree using DFS
Finding the N'th number in the Fibonacci sequence
Generating Fibonacci Sequence
Java : Create and Initialize List
Line Segment Intersection
Merge Sort
Searching A Node In Binary Search Tree
Solving N Queens Problem Using Backtracking
All paths in a directed acyclic graph
Detecting cycle in directed graphs using Depth-First-Search (DFS)
Generating permutations using recursion
Java : Adjacency list implementation for storing graph
Java : List of arrays
Prim's Algorithm in Java
QuickSort Algorithm
Toggle last set bit in an integer
Detecting cycle in an undirected graphs using Depth-First-Search (DFS)
Generating subsets or combinations using recursion
Letter Phone
Generating integer partitions using backtracing & recursion
Kruskal's Minimum Spanning Tree Algorithm
Euler's Totient Function
Finding the K most frequent elements in an array
Generating All Combinations Of Balanced Parenthesis
Algorithm for Solving Tower Of Hanoi
Binary Search
Searching a number in a 2D Sorted Matrix
Counting Distinct Substrings In A Given String Using Trie
Algorithm : Infix To Postfix Conversion
Finding count of duplicate numbers in a sorted array
Longest Common Subsequence
Prime Sieve Algorithm ( Sieve of Eratosthenes )
Algorithm : Evaluating an infix expression
Binary Indexed Tree / Fenwick Tree
Java : Dijkstra's Algorithm
Finding Prime Factors Of A Number
Finding the Largest Area Rectangle In A Histogram
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)
Square Root using Binary Search
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
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
Longest Palindromic Substring
Checking if a number is prime or non prime
0-1 Knapsack Problem
Minimum coins for a change
Binary Search : Allocate books
Binary Search : Ship packages
Algorithm For Finding Binomial Coefficents
Depth First Search ( DFS ) Algorithm
Finding the maximum sum of a subarray in an array
Generating combinations (subsets) using bitwise operations
Topological Sort
Climbing Stairs
Check If A binary tree is a subtree in another binary tree (supertree)
Matrix Multiplication
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
Trie implementation [Python & Java]