Skip to main content
Tweeted twitter.com/StackMma/status/1306563562593280003
fix typo
Source Link
AsukaMinato
  • 10.4k
  • 1
  • 17
  • 44
<< Combinatorica`
Permutations[Range[0, 9]][[1000000]] // AbsoluteTiming
Nest[NextPermutation, Range[0, 9], 1*^6 - 1] // AbsoluteTiming

I want to save memory, so I tryiedtried NextPermutation ,but it's kind of slow, why?

enter image description here

<< Combinatorica`
Permutations[Range[0, 9]][[1000000]] // AbsoluteTiming
Nest[NextPermutation, Range[0, 9], 1*^6 - 1] // AbsoluteTiming

I want to save memory, so I tryied NextPermutation ,but it's kind of slow, why?

enter image description here

<< Combinatorica`
Permutations[Range[0, 9]][[1000000]] // AbsoluteTiming
Nest[NextPermutation, Range[0, 9], 1*^6 - 1] // AbsoluteTiming

I want to save memory, so I tried NextPermutation ,but it's kind of slow, why?

enter image description here

title grammar
Link
flinty
  • 25.9k
  • 2
  • 22
  • 92

Why doesis NextPermutation slow?

Source Link
AsukaMinato
  • 10.4k
  • 1
  • 17
  • 44

Why does NextPermutation slow?

<< Combinatorica`
Permutations[Range[0, 9]][[1000000]] // AbsoluteTiming
Nest[NextPermutation, Range[0, 9], 1*^6 - 1] // AbsoluteTiming

I want to save memory, so I tryied NextPermutation ,but it's kind of slow, why?

enter image description here