A simple yet powerful optimization algorithm is proposed in this paper for solving the constrained and unconstrained optimization problems. This algorithm is based on the concept that the solution obtained for a given problem should move towards the best solution and should avoid the worst solution. This algorithm requires only the common control parameters and does not require any algorithm-specific control parameters. The performance of the proposed algorithm is investigated by implementing it on 24 constrained benchmark functions having different characteristics given in Congress on Evolutionary Computation (CEC 2006) and the performance is compared with that of other well-known optimization algorithms. The results have proved the better effectiveness of the proposed algorithm. Furthermore, the statistical analysis of the experimental work has been carried out by conducting the Friedman’s rank test and Holm-Sidak test. The proposed algorithm is found to secure first rank for the ‘best’ and ‘mean’ solutions in the Friedman’s rank test for all the 24 constrained benchmark problems. In addition to solving the constrained benchmark problems, the algorithm is also investigated on 30 unconstrained benchmark problems taken from the literature and the performance of the algorithm is found better.