Function Search(maze): frontier = new OrderedCollection frontier.insert(start) mark start as seen While frontier not empty: cell = frontier.remove() For each neighbor of cell: If neighbor is Finish: follow parent pointers to build path return path End If If neighbor not seen: frontier.insert(neighbor) mark neighbor as seen mark cell as neighbor's parent End If End For End While Return failure End Function