We introduce a novel method and two algorithms for designing efficient degree distributions with minimum overhead for online codes. The first algorithm is the general form for solving the problem of overhead minimization and the second one is an adaptive method based on the first method. In these two approaches, the codes are designed based on a discretized non-linear optimization problem. One direct result of the presented algorithms is decreasing the number of samples for solving the non-linear programming problem of the overhead minimization problem, which is not easy to solve without discretization. Also, we find a simple criteria in order to choose the critical sample points and show that the convergence rate improves. By considering these algorithms, one can construct an online code with minimum overhead for any given erasure channel parameter. Furthermore, the complexity of our algorithms has a linear relation with the number of samples because linear programming model is used. Simulation results are presented that show the efficiency of the proposed algorithms.