All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.changebooks.optimal.permutation.Permutations Maven / Gradle / Ivy

package io.github.changebooks.optimal.permutation;

/**
 * 生成数组下标的全排列
 * 
 *   数组长度:1
 *   数组下标:[0]
 * 下标全排列:[0]
 * 
*
 *   数组长度:2
 *   数组下标:[0, 1]
 * 下标全排列:[0, 1], [1, 0]
 * 
*
 *   数组长度:3
 *   数组下标:[0, 1, 2]
 * 下标全排列:[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]
 * 
* * @author [email protected] */ public interface Permutations { /** * 按指定数组长度(size),生成数组下标,并全排列该下标 * 如, *
     *     指定数组长度:3
     *   生成的数组下标:[0, 1, 2]
     * 数组下标的全排列:[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]
     * 
*
     * (size = 0) : []
     * (size = 1) : [ [0] ]
     * (size = 2) : [ [0, 1], [1, 0] ]
     * (size = 3) : [ [0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0] ]
     * ... ...
     * 
* * @param size 指定数组长度 * @return 数组下标的全排列 */ int[][] compute(int size); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy