solved search algo