Two implementation of agglomerative clustering: one using arrays and one
using hash map.