a) How does PAM (K-medoids) form clusters; how does DBSCAN form clusters?

a) How does PAM (K-medoids) form clusters; how does DBSCAN form clusters?