x Turn on thread page Beta
 You are Here: Home >< Maths

# D1 Permutation Question watch

1. Don't really understand the steps in the question. What do you do from Step 4 onwards? 😕

Sent from my iPhone using Tapatalk
2. SeanFM might be able to help here, I don't do Decision, unfortunately, sorry!
3. (Original post by TSRforum)

Don't really understand the steps in the question. What do you do from Step 4 onwards? 😕

Sent from my iPhone using Tapatalk
Have you followed it up to Step 3?

What do you think it's doing in Step 4?
4. (Original post by TSRforum)

Don't really understand the steps in the question. What do you do from Step 4 onwards? 😕

Sent from my iPhone using Tapatalk

step 2 sets up the following array 1 2 3 4 5 step 3 sets j as 1

Step 4 generates a random number in the range 1 to 5 see note (a) in the question. The number generated is 3 and r now equals 3
It swaps the array element j ie. element 1 with element r ie element 3. After this point element 1 holds the number 3 and element 3 holds the number 1.
j is now increased by 1 to give j as 2
one is subtracted from n to give n = 4
as n does not equal j the loop is repeated ie. control passes back to the beginning of step 4
5. (Original post by maggiehodgson)
step 2 sets up the following array 1 2 3 4 5 step 3 sets j as 1

Step 4 generates a random number in the range 1 to 5 see note (a) in the question. The number generated is 3 and r now equals 3
It swaps the array element j ie. element 1 with element r ie element 3. After this point element 1 holds the number 3 and element 3 holds the number 1.
j is now increased by 1 to give j as 2
one is subtracted from n to give n = 4
as n does not equal j the loop is repeated ie. control passes back to the beginning of step 4

Anything I did wrong here? (Mind the 2 arrows pointing to 4 in perm(2))

Sent from my iPhone using Tapatalk
6. (Original post by TSRforum)

Anything I did wrong here? (Mind the 2 arrows pointing to 4 in perm(2))

Sent from my iPhone using Tapatalk
Sorry for the delay in reply. And now I'm back on TSR I can't read your workings properly. I'll try again.
7. (Original post by TSRforum)

Anything I did wrong here? (Mind the 2 arrows pointing to 4 in perm(2))

Sent from my iPhone using Tapatalk
I got the same up to the last step. I imagine that you're doing it right and I'll have made an error on the last line somewhere.

However, I think that the array is called Perm. Perm is a special type of variable that can hold 5 different values at the same time. Each element of the array is accessed by an index that is the position in the array. So I think that labelling the rows as Perm(1), Perm(2).. etc was a bit mis-leading for me.

So I set my work out like this (see the attachment).
Attached Images
8. Scan0008.pdf (139.7 KB, 44 views)
9. (Original post by maggiehodgson)
I got the same up to the last step. I imagine that you're doing it right and I'll have made an error on the last line somewhere.

However, I think that the array is called Perm. Perm is a special type of variable that can hold 5 different values at the same time. Each element of the array is accessed by an index that is the position in the array. So I think that labelling the rows as Perm(1), Perm(2).. etc was a bit mis-leading for me.

So I set my work out like this (see the attachment).
Your answer is right though why is there three step 4's? And why is step 3 blank with j=1? Also what about r=5 doesn't that get used? 😣

Sent from my iPhone using Tapatalk
10. (Original post by TSRforum)
Your answer is right though why is there three step 4's? And why is step 3 blank with j=1? Also what about r=5 doesn't that get used? 😣

Sent from my iPhone using Tapatalk
The only change to the variables in step 3 is when j gets set to 1. None of the others get changed so whatever they were in previous steps remain on earlier rows.

Step 4 is a loop and many things happen in it. Array elements get swapped and j and r change so they are all on the line called Step4. I suppose you could have split that line into many lines with only one row header but I didn't. At the end of the loop, control returns to the first instruction in Step 4.

Now, in my work, I did have an extra line that had r = 5 but the end result of that did not match yours whilst all the others did. I assumed that I would be wrong so folded over my last line before scanning.

In a previous post I did say that the way to present you table could well vary from exam board to exam board so my workings with all of Step4 being on one line might not be right for you. You would have to check that with your school.

Hope my explanation is OK for you.

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: February 14, 2016
Today on TSR

### University rankings 2019

Cambridge at number one

Poll
Useful resources

### Maths Forum posting guidelines

Not sure where to post? Read the updated guidelines here

### How to use LaTex

Writing equations the easy way

### Study habits of A* students

Top tips from students who have already aced their exams