Statistics for Efficient algorithms in quantum query complexity