In problems such as finding connected components, is it better to use the more advanced algorithm such as union-find? I realize DFS could work for a lot of cases. Aiming for FANNG.