Breadth first search and depth first search on maze solving