Card sorting

I have to write card sorting program using circular buffer or queue.
Main idea is you have n card, and rule you /pick one card and second card put next to the last, and how can i do this one? what is algorithm?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

1-9-2-13-3-10-4-14-5-11-6-15-7-12-8-16|9-13-10-14-11-15-12-16|13-15-14-16-|15-16
can anyone help me please?
Last edited on
Main idea is you have n card, and rule you /pick one card and second card put next to the last
Can you describe this in more detail? It would be best if you can post the text of the assignment.
Topic archived. No new replies allowed.