add heap sort and inversions counting