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!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…