Implementation of optimal hierarchical clustering
