Implement DFS adn BFS