Category Archives: Source Code
Hierholzer’s algorithm to find Euler path – undirected graph
Topological sort using DFS and BFS
Find all subset of string in dictionary – code

Find all subset of string in dictionary is to find the subset of an input string that exists in dictionary. The dictionary contains one million words. For this question, the trick is to find subset, not substring. The difference between substring and subset is: The substring is contiguous sequence of …
Find all distinct palindromic substrings using suffix trie
Domino Eulerian path problem using backtracking
Modulo operation and circular array
Josephus problem using circular linked list
Detect cycle and remove cycle in directed graph
Get suggested friends (2 solutions) – DFS and Union Find

Get suggested friends is one of a coding question in social network applications. The data structures for social network is usually a graph. In the graph, you can use depth first search(DFS) or breadth first search(BFS) to find the connections between people. Alternatively, you can also use Union find to …