3.3.25.2 Algorithm pseudocode