Divide sequence elements into pairs

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2010-06-07T05:14:55Z Indexed on 2010/06/07 5:22 UTC
Read the original article Hit count: 225

Filed under:
|

I have a sequence of 16 elements: 1,2,3,..., 16 ( or 2*n elements). Sequence elements always goes from 1 to length(sequence) that is sequence of 4 elements is 1,2,3,4.

I want to write an algorithm which divide elements into pairs. For Example, 1-15 2-16 3-13 4-9 5-14 6-10 7-11 8-12

PS: no linq please :)

© Stack Overflow or respective owner

Related posts about c#

Related posts about algorithm