20件ヒット
[1-20件を表示]
(0.030秒)
ライブラリ
- ビルトイン (20)
キーワード
- combination (6)
- permutation (6)
-
repeated
_ combination (4) -
repeated
_ permutation (4)
検索結果
先頭5件
-
Array
# permutation(n) { |p| block } -> Array (62258) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...1, 2, 3]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one permutation of length 0
a.permutation(4).to_a #=>......[] : no permutations of length 4
@see Array#combination......[] : no permutations of length 4
@see Array#combination, Array#repeated_permutation... -
Array
# permutation(n) -> Enumerator (62158) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...1, 2, 3]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one permutation of length 0
a.permutation(4).to_a #=>......[] : no permutations of length 4
@see Array#combination, Array#repeated_permutation... -
Array
# permutation(n) -> Enumerable :: Enumerator (62146) -
サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。
...1, 2, 3]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one permutation of length 0
a.permutation(4).to_a #=>......[] : no permutations of length 4
@see Array#combination... -
Array
# repeated _ permutation(n) { |p| . . . } -> Array (27258) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=......> [[]] # one permutation of length 0
@see Array#repeated_combination, Array#permutation... -
Array
# repeated _ permutation(n) -> Enumerator (27158) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=......> [[]] # one permutation of length 0
@see Array#repeated_combination, Array#permutation... -
Array
# combination(n) {|c| block } -> Array (21126) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] : no combinations of length 5
@see Array#permutation......],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] : no combinations of length 5
@see Array#permutation, Array#repeated_combination... -
Array
# repeated _ combination(n) { |c| . . . } -> Array (21120) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
@see Array#repeated_permutation, Array#combination... -
Array
# combination(n) -> Enumerator (21026) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] : no combinations of length 5
@see Array#permutation, Array#repeated_combination... -
Array
# combination(n) -> Enumerable :: Enumerator (21020) -
サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。
...[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] : no combinations of length 5
@see Array#permutation... -
Array
# repeated _ combination(n) -> Enumerator (21020) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
@see Array#repeated_permutation, Array#combination...
