Added the concept of weight to the Algorithms.