Depth-First Search

  1. Graph Valid Treearrow-up-right (use List<Set<Integer>> instead of List<List<Integer>>, in order to remove key in undirected graph)

  2. Find Leaves of Binary Treearrow-up-right skills to get the height of node and add the node to the proper position using DFS

1. DFS in Matrix

2. DFS in Graph

3. DFS + Memoization

Last updated