BinarySearch, BFS and DFS algorithm