shellsort modified to keep h values in a stack