- BST - CRUD, min-max, height etc.
- Serialization & Deserialization - Binary Tree
- Serialization & Deserialization - Binary Search Tree
- Check if tree is BST
- Path(s) from root to leaves
- Convert a unbalanced BST to balanced BST
- Construct a BST from given sorted array
- Children sum property - For each node, node.data = node.left.data + node.right.data (for leaves data=0)
- Distance between 2 arbitrary nodes
- Distance between root & any arbitrary node
- Inorder successor & predecessor
- To check whether binary is balanced
- Path with sum equals to given sum
- Pair(s) with sum equals to given sum
- Tree views - Top, Left, Bottom, Right
- LCA - Lowest Common Ancestor
- To check whether binary trees are mirror of each other
- Convert a binary tree to it's mirror
- Move children to left/right
- To find node(s) at distance 'k' from root
- To find path from root to a given node
- To find out sum of all nodes' data
- Binary tree traversals - Preorder, Inorder, Postorder, Level order, Spiral(zig-zag)
- Vertical sum of binary tree
- Diameter of binary tree
- Maximum width of binary tree
- Height of binary tree
- Print diagonals of binary tree
- Diagonal sum of a binary tree
- Binary tree to DDL
- Isomorphic trees
- Segment Tree
- Representation - Sparse matrix, Adjecency list
- Traversals - BFS, DFS
- Topological sort - Using DFS, Kahn's algo
- Detect cycle - Directed graph(Using DFS coloring, topological order)
- Detect cycle - Undirected graph(Using disjoint set, BFS, DFS, DFS coloring)
- Disjoint set
- Minimum spanning tree - Prim's algorithm
- Minimum spanning tree - Kruskal's algorithm
- Single source shortest path - Dijkstra's algorithm
- Single source shortest path - Bellman-Ford's algorithm
- All pairs shortest path - Floyd-Warshall's algorithm
- Knight tour with custom rules - Warnsdorff's algorithm
- To reverse an array
- To rotate an array by 'd'
- To find out Pair(s) with given sum 's' in sorted array
- To find out Pair(s) with given sum 's' in unsorted array
- Rearrange numbers in array such that +ve & -ve numbers are placed alternatively
- Move all -ve numbers to the left and +ve numbers to the right in array
- Segregate 0's & 1's in an array
- Segregate 0's, 1's & 2's in an array (Dutch-National-Flag algorithm)
- Rearrange an array in max-min form, i.e. 1st max, 1st min, 2nd max, 2nd min
- The longest sub-array having equal numbers of 0s and 1s
- Maximum product sub-array & minimum product sub-array
- Form largest number by re-arranging array elements
- Kadane's algorithm, max sum sub-array
- Find element in row-wise & col-wise sorted matrix
- Given prices in increasing order of time, buy, sell & maximize profit
- Find zeroes to be flipped so that number of consecutive 1’s is maximized
- Predecessor in sorted array
- Next greater elements
- Next greatest elements
- Checks if number is prime
- Fibonacci Series
- Factorial of a number
- Leader(s) in array
- Majority element - Moore's voting algorithm
- Minimum from Stack in constant O(1) time
- Minimum steps to reach a target
- Stock-Span problem
- Median of two sorted arrays
- To find out the number of BSTs can be formed with 'n' sorted elements/keys
- Check if array can be partitioned into two subsets such that the sum of elements in both subsets is same
- Coin change problem
- Knapsack 0-1 problem
- Longest common sub-sequence(LCS)
- Longest repeated sub-sequence(LRS)
- Longest increasing sub-sequence(LIS)
- Subset-sum problem
- Cutting rod into pieces to maximize profit
- Square sub-matrix with maximum consecutive 1's
- Minimum jump(s) required to reach at the end of the array
- Number of ways to reach some position in matrix(moves: right, bottom)
- Ugly numbers
- Super-Ugly numbers
- Weighted-job-scheduling
- Minimum Number of Platforms Required for a Railway/Bus Station
- Binary search
- Binary search in circularly sorted array
- To find out the number of times sorted array is rotated
- Trie - Insert, Search, Prefix-Search(autocomplete), Delete
- Contacts list - Add, search, prefix search, count, delete
- Singly linked list - Insert at first, last and in middle
- Deleting a node from singly linked list
- Merge two sorted linked lists
- Doubly linked list - Insertion, deletion
- Add 2 numbers represented by linked lists and save to new linked list
- Multiply 2 numbers represented by linked lists
- LRU Cache
- Custom hashtable implementation
- Custom thread pool
- Time-based Cache with TTL(Like Redis/Aerospike)
- Villagers-Queue-Bucket problem
- Battleship game
- Check if strings are anagrams
- Move to
<project-dir>
, create virtual environment and then activate it as
$ cd <project-dir>
$ virtualenv -p python3 .environment
$ source .environment/bin/activate
Note: Step-1 is optional but recommended.
- Add project to
PYTHONPATH
as
$ export PYTHONPATH="$PYTHONPATH:." # . corresponds to current directory(project-dir)
If you are using PyCharm then it can be done under
run configuration
.
- Compile & Run
javac <file_name>.java
java <Main>