ALGORITHM

Images to explain how works the algorithm.