shell sort with template sort