Average-case analysis for combinatorial problems