Cognizant Interview Question

About trees and graphs, DFS BFS