pseudocode of BFS && DFS in Java