front left back right searching algorithm