edit search algorithm