algorithm 4ed