add PAM algorithm with an example