Find all possible pairs in an array

java, recursion

Solution

In case pairs `ab` and `ba` are different, do:

for i=0 to array.length
  for j=0 to array.length
    if i == j skip
    else construct pair array[i], array[j] 

and if not, do something like this:

for i=0 to array.length-1
  for j=i+1 to array.length
    construct pair array[i], array[j] 

Note that I am assuming the array holds unique strings!

Problem

Its when I try to do stuff like this I realise I really need to go to university! Anyway I have an array of strings (275) I need to loop through them and create strings of all the possible pairs, in Java. I've been learning about recursion but I cant find the answer for this.

Original source

Related problems