added inversions in array spec and algo