Description: Get DFS space advantage with BFS’s time for shallow solution advantag Run DFS with depth limit of 1, if not run with limit 2,…