Undo implemented

Implemented the undo method for the search algorithms