euclidean algos - cpp implementations