1 5 7 1 2 3
2 4 3 4 5 UNIVERSITY-EXERCISE
8 6 6 7 8
A B

I need to write a recoursive function, that calculates
the way to reach the B-configuration of the numbers
when called with the A-configuration. (or any other A-
configuration)

ALGORITHM OR FUNCTION BODY, I'VE NO IDEA OF HOW
TO SOLVE THIS EXERCISE.

2. Which is A and which B?
BTW, it's spelled recursive.
Al

3. 1-5-6***1-2-3
8-2-3***4-x-5
x-7-4***6-7-8
--A---------B---
A card, for example '8', can only be moved to a
free place, marked with x. ? No idea.

4. ## recursive function help

This is a sorting problem. Here's the answer, in English.
1. Create an array,

2. success is when each slot contains its number, i.e. 1 has 1, 2 has 2, etc, except that 5 contains 0 which is what we use for x, and slot 0 is not used at all.

3. step 1, read the A position into the array. Suppose it looks like this: 9999,8,4,2,1,3,5,6,7,0,9. You want to end with: 9999,1,2,3,4,0,6,7,8,9.

step a: exchange its contents with whatever slot contains the 0,
-- this puts the x in slot 1
9999,0,4,2,1,3,5,6,7,8,9

step b: now exchange its contents with whatever slot contains the 1.
You now have: 9999,1,4,2,0,3,5,6,7,8,9

4. now do the same for slot 2, that's the recursive call, then slot 3, etc, except you skip slot 5 because that's supposed to end up with the empty.

5. the end condition for your function is when next_slot > 9.

Good luck, Al

5. Thanks!!!!
Usually I had no problems with my uni exercises,
but recoursive functions and recoursive classes are
desperating.
Thanks again!