DESPOTA: an algorithm to detect the partition in the extended hierarchy of a dendrogram