Shell-sort algorithm variations in Java

前端 未结 2 371
死守一世寂寞
死守一世寂寞 2021-01-20 17:38

Is there a way to calculate the starting point of a for loop and the adjustments to it. The original loop has these conditions

for( int gap = a.length / 2; g

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-20 18:17

    for( int gap = 1; gap < ((a.length + 2)/3); gap = (((((gap *2)+1)*3)-1)/2))
    

提交回复
热议问题