using sparse matrix in merging function

The original data structure is std::vector, and it uses a lot of memory
when clusters number(n) are big, such as n x n.  Notice that, most of
element in matrix are zero. So I replaces it by sparse matrix, and uses
data structure std::list. Now, both running speed and memory usage are
imporved