Reimplementation search algorithm (without cost updating)