Permutation in array

I have an array size n, filled with double values. I want to make some mathematical calculations (queue) and i have to get all posible combinations of elements in array. Something like this:

  for (int i=0; i<array.length;i++) {
       for (int j=0; j<array.length;j++)
                        //here will be my formula which uses all elements in array
     // here should be used permutation of elements
                                                 }

I really don't know how to do permutations. Can someone help me please?
PremanidhiAsked:
Who is Participating?
 
PremanidhiAuthor Commented:
sorry my first algorithem was wrong. Take this one:
while all combinations of elements in array are not set {
       for (int j=0; j<array.length;j++)
                        //here will be my formula which uses all elements in array
     // here should be used permutation of elements
                                                 }
0
 
NaeemgCommented:
if u want to use value in array then ,

array[j]

will return double value from current position of array.

and for permutation visit these links.

http://www.cs.princeton.edu/introcs/25array/Permutation.java.html
http://javamath.sourceforge.net/javadoc/javamath/util/math/Permutation.html
http://www.cs.utexas.edu/users/downing/cs315/elements/NextPermutation.html
0
All Courses

From novice to tech pro — start learning today.