while ngrows slower than nn (because any positive integer constant chap mathematical preliminaries pn/en )it grows faster than cn for permutationsa permutation of sequence is simply the members of arranged in some order for examplea permutation of the integers through would be those values arranged in some order if the sequence contains distinct membersthen there are ndifferent permutations for the sequence this is because there are choices for the first member in the permutationfor each choice of first member there are choices for the second memberand so on sometimes one would like to obtain random permutation for sequencethat isone of the npossible permutations is selected in such way that each permutation has equal probability of being selected simple java function for generating random permutation is as follows herethe values of the sequence are stored in positions through of array afunction swap(aijexchanges elements and in array aand random(nreturns an integer value in the range to (see the appendix for more information on swap and random/randomly permute the values of array "astatic void permute( [afor (int lengthi --/for each swap(ai- dsutil random( ))/swap [ - with / random element boolean variablesa boolean variable is variable (of type boolean in javathat takes on one of the two values true and false these two values are often associated with the values and respectivelyalthough there is no reason why this needs to be the case it is poor programming practice to rely on the correspondence between and falsebecause these are logically distinct objects of different types floor and ceilingthe floor of (written bxctakes real value and returns the greatest integer < for exampleb as does cwhile - - and - - the ceiling of (written dxetakes real value and returns the least integer > for exampled as does ewhile - - - modulus operatorthe modulus (or modfunction returns the remainder of an integer division sometimes written mod in mathematical expressionsthe syntax for the java modulus operator is from the definition of remaindern mod is the integer such that qm for an integerand | |mthereforethe result of mod must be between and when and are