Combinations (repetition not allowed & order not important)
You seem interested in just pairs of indices. Then, if you have $n$ elements you can just generate all pairs of indices  $(i,j)$ with $0 \le i &lt; j &lt; n$.
For i=0,1,...,n-2:
   For j=i+1, i+2, ..., n-1:
      Output (i,j)