Implements Shell sort.