add heap algorithm for solution