Algorithms for Generic Programming class