ricky

15 Reputation

2 Badges

14 years, 240 days

MaplePrimes Activity


These are replies submitted by ricky

ok thanks I've tried that but now the algorithim is not looping back if a female rejects someone she was allready proposed to i.e. putting in these two arrays A:=Array(1..4,1..4):
B:=Array(1..4,1..4):

A[1,1]:=4:
 A[1,2]:=1:
 A[1,3]:=2:
 A[1,4]:=3:
 A[2,1]:=2:
A[2,2]:=3:
 A[2,3]:=1:
 A[2,4]:=4:
A[3,1]:=2:
 A[3,2]:=4:
 A[3,3]:=3:
 A[3,4]:=1:
A[4,1]:=3:
 A[4,2]:=1:
 A[4,3]:=4:
 A[4,4]:=2:
B[1,1]:=4:
 B[1,2]:=1:
 B[1,3]:=3:
 B[1,4]:=2:
B[2,1]:=1:
 B[2,2]:=3:
 B[2,3]:=2:
 B[2,4]:=4:
B[3,1]:=1:
 B[3,2]:=2:
B[3,3]:=3:
B[3,4]:=4:
 B[4,1]:=4:
 B[4,2]:=1:
B[4,3]:=3:
 B[4,4]:=2:

with A the male preferences and B the female preferences we get the answer = [4, 0, 2, 3] where it should be [4, 3, 2, 1].  I thought that by me putting for d from 1 while g<>n do would have resolved this but obviously not.  I'm now thinking that the probklem is in the line g:=g+1:    Again any help would be greatly appreciated!!

ok thanks I've tried that but now the algorithim is not looping back if a female rejects someone she was allready proposed to i.e. putting in these two arrays A:=Array(1..4,1..4):
B:=Array(1..4,1..4):

A[1,1]:=4:
 A[1,2]:=1:
 A[1,3]:=2:
 A[1,4]:=3:
 A[2,1]:=2:
A[2,2]:=3:
 A[2,3]:=1:
 A[2,4]:=4:
A[3,1]:=2:
 A[3,2]:=4:
 A[3,3]:=3:
 A[3,4]:=1:
A[4,1]:=3:
 A[4,2]:=1:
 A[4,3]:=4:
 A[4,4]:=2:
B[1,1]:=4:
 B[1,2]:=1:
 B[1,3]:=3:
 B[1,4]:=2:
B[2,1]:=1:
 B[2,2]:=3:
 B[2,3]:=2:
 B[2,4]:=4:
B[3,1]:=1:
 B[3,2]:=2:
B[3,3]:=3:
B[3,4]:=4:
 B[4,1]:=4:
 B[4,2]:=1:
B[4,3]:=3:
 B[4,4]:=2:

with A the male preferences and B the female preferences we get the answer = [4, 0, 2, 3] where it should be [4, 3, 2, 1].  I thought that by me putting for d from 1 while g<>n do would have resolved this but obviously not.  I'm now thinking that the probklem is in the line g:=g+1:    Again any help would be greatly appreciated!!

Page 1 of 1