described the basic algorithm.