Cognizant interview question

About trees and graphs, DFS BFS