Skip to main content
Typo fix
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221

Score: 4583

def rand_shell(l): steps = [1, 3, 5, 9, 17, 33, 65, 129] candidates = [(left, left + step) for (step, nstep) in zip(steps, steps[1:]) for left in range(0, l - step) for i in range(nstep // step) ] return random.choice(candidates) 

Try it online!

I've no idea why. I just tried sequences listed on wikipedia artical for shellsort. And this one seem works best. It get similar score with the one xorxnor posted.

Score: 4583

def rand_shell(l): steps = [1, 3, 5, 9, 17, 33, 65, 129] candidates = [(left, left + step) for (step, nstep) in zip(steps, steps[1:]) for left in range(0, l - step) for i in range(nstep // step) ] return random.choice(candidates) 

Try it online!

I've no idea why. I just tried sequences listed on wikipedia artical for shellsort. And this one seem works best. It get similar score with the one xor posted.

Score: 4583

def rand_shell(l): steps = [1, 3, 5, 9, 17, 33, 65, 129] candidates = [(left, left + step) for (step, nstep) in zip(steps, steps[1:]) for left in range(0, l - step) for i in range(nstep // step) ] return random.choice(candidates) 

Try it online!

I've no idea why. I just tried sequences listed on wikipedia artical for shellsort. And this one seem works best. It get similar score with the one xnor posted.

deleted 1 character in body
Source Link
tsh
  • 36.2k
  • 2
  • 36
  • 133

Score: ~46504583

def rand_shell(l): steps = [1, 3, 5, 9, 17, 33, 65, 129] candidates = [(left, left + step) for (step, nstep) in zip(steps, steps[1:]) for left in range(0, l - step) for i in range(nstep // step) ] return random.choice(candidates) 

Try it online!

I've no idea why. I just tried sequences listed on wikipedia artical for shellsort. And this one seem works best. It get similar score with the one xor posted.

Score: ~4650

def rand_shell(l): steps = [1, 3, 5, 9, 17, 33, 65, 129] candidates = [(left, left + step) for (step, nstep) in zip(steps, steps[1:]) for left in range(0, l - step) for i in range(nstep // step) ] return random.choice(candidates) 

Try it online!

I've no idea why. I just tried sequences listed on wikipedia artical for shellsort. And this one seem works best. It get similar score with the one xor posted.

Score: 4583

def rand_shell(l): steps = [1, 3, 5, 9, 17, 33, 65, 129] candidates = [(left, left + step) for (step, nstep) in zip(steps, steps[1:]) for left in range(0, l - step) for i in range(nstep // step) ] return random.choice(candidates) 

Try it online!

I've no idea why. I just tried sequences listed on wikipedia artical for shellsort. And this one seem works best. It get similar score with the one xor posted.

Source Link
tsh
  • 36.2k
  • 2
  • 36
  • 133

Score: ~4650

def rand_shell(l): steps = [1, 3, 5, 9, 17, 33, 65, 129] candidates = [(left, left + step) for (step, nstep) in zip(steps, steps[1:]) for left in range(0, l - step) for i in range(nstep // step) ] return random.choice(candidates) 

Try it online!

I've no idea why. I just tried sequences listed on wikipedia artical for shellsort. And this one seem works best. It get similar score with the one xor posted.