Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Math 在不改变数组元素的相对顺序的情况下,数组的分区数是多少?_Math_Combinations_Combinatorics - Fatal编程技术网

Math 在不改变数组元素的相对顺序的情况下,数组的分区数是多少?

Math 在不改变数组元素的相对顺序的情况下,数组的分区数是多少?,math,combinations,combinatorics,Math,Combinations,Combinatorics,我们得到一个由n个整数组成的数组(不一定是不同的)。将阵列划分为连续的非空子阵列的方法总数是多少 示例:数组A=[1,2,3]。那么分区的数量将是4: {1,2,3} {1} {2,3} {1,2} {3} {1} {2} {3} 错误的分区:{1,3}{2}我将首先解释给定数组A=[1,2,3],然后将其扩展到长度为N的数组 让我们将数组的元素表示为3个不同的王国。数组的元素是否不同并不重要,我们必须假设它们是不同的。另外,假设任意两个相邻王国之间存在二进制开关。如果开关为1,则在两个

我们得到一个由n个整数组成的数组(不一定是不同的)。将阵列划分为连续的非空子阵列的方法总数是多少

示例:数组A=[1,2,3]。那么分区的数量将是4:

{1,2,3}

{1} {2,3}

{1,2} {3}

{1} {2} {3}

错误的分区:{1,3}{2}

我将首先解释给定数组A=[1,2,3],然后将其扩展到长度为N的数组

让我们将数组的元素表示为3个不同的王国。数组的元素是否不同并不重要,我们必须假设它们是不同的。另外,假设任意两个相邻王国之间存在二进制开关。如果开关为1,则在两个相邻的王国之间创建一个分区,否则没有分区

1 [0] 2 [0] 3 --> {1,2,3}

1 [1] 2 [0] 3 --> {1} {2,3}

1 [0] 2 [1] 3 --> {1,2} {3}

1 [1] 2 [1] 3 --> {1} {2} {3}
我们看到每个开关有两种可能性[0]和[1]。这些开关的不同组合导致不同的分区。因此,分区的总数为2x2=4

扩展到N个元素,将有(N-1)个交换机,每个交换机有2种可能性,分区总数将为2x2x2x。。。x2(N-1)次=2^(N-1)