code for bottom up simple average based hierarchcial cluster