Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
harry1357931 committed Jul 4, 2013
1 parent 212f048 commit 26a1925
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ For example m1 would prefer w2 to w1 and likewise w2 prefers m1 to m2.
Use the same approach that we used for the one dimensional eight queens problem. In the array q, q[i] is the woman
assigned to man i. The main program stays the same, besides the limits on the loops. All that needs to change is the
ok<br> function. Is could look something like this:
<br><br>
<br><b>bool ok(int q[], int col)</b> {
<b<br>r><br> col indicates the new man and q[col] the new woman proposed to be added to the match.
<br><br>We need to do 2 tests:
<br> 1. If the new woman has already been assigned to some man then return false
<br> 2. Check the new pair (new man, new woman) against each existing pair consisting of (current man, current woman) to see if the new pair would make the match unstable. So
<br> a. if the current man prefers the new woman to his partner and
<br> b. if the new woman prefers the current man to her partner
<br> i. this is unstable, so return false
<br> c. if the new man prefers the current woman to his partner and
<br> d. if the current woman prefers the new man to her partner
<br> i. This is unstable, so return false
<br> e. if there are no instabilities introduced with any of the existing (i.e. “current”) couples, so we return true.
<br>&nbsp;&nbsp;&nbsp;&nbsp;
<br><b>b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ool ok(int q[], int col)</b> {
<b<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; col indicates the new man and q[col] the new woman proposed to be added to the match.
<br><br>We &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;need to&nbsp;&nbsp;&nbsp; do 2 tets:
<br>&nbsp;&nb&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sp;&nbsp;&nbsp; 1. If the new woman has already been assigned to some man then return false
<br>&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;&nbsp;&nbsp; 2. Check the new pair (new man, new woman) against each existing pair consisting of (current man, current woman) to see if the new pair would make the match unstable. So
<br>&nbsp;&nbsp;&nbs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p;&nbsp;&nbsp; a. if the current man prefers the new woman to his partner and
<br>&nbsp;&nbsp;&nbs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p;&nbsp;&nbsp;&nbsp; b. if the new woman prefers the current man to her partner
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i. this is unstable, so return false
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c. if the new man prefers the current woman to his partner and
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d. if the current woman prefers the new man to her partner
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i. This is unstable, so return false
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e. if there are no instabilities introduced with any of the existing (i.e. “current”) couples, so we return true.
<br>}

0 comments on commit 26a1925

Please sign in to comment.