merge k lists using heap