Re: recursive classes
From: Andy (andyfaeglasgow_at_yahoo.co.uk)
Date: 06/25/04
- Next message: kevin: "Re: Need help on Math Calculation with Java"
- Previous message: Roedy Green: "Re: "Global" variables using static class"
- In reply to: Roedy Green: "Re: recursive classes"
- Next in thread: Roedy Green: "Re: recursive classes"
- Reply: Roedy Green: "Re: recursive classes"
- Reply: John C. Bollinger: "Re: recursive classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Jun 2004 09:45:18 -0700
Hi John,
Before writing this post I must declare that this problem is part of a
dissertation I'm writing for an MSc...so don't be too forthcoming with
solutions or else I'll feel as if I haven't earned it ;-)
However, the problem is quite an interesting one and you might like to
hear about it so...
The two classes represent entities that have preferences over one
another. So for example
class Man {
List preferences; //is an ordered list of Woman objects
}
class Woman {
List preferences; //is an ordered list of Man objects
}
The interesting part is that you have to pair up the Man and Woman
objects such that no member of any pair could find a better partner
than the one they are allocated with (given the preferences of all the
"opposing" objects).
A bonus puzzle (for added kudos) is that one of the objects should be
allowed to express indifference in their preferences; so for example,
woman#1 likes man#1 better than both man#2 and man#3, but is
indifferent between man#2 and man#3.
The actual algorithm for the problem has already been published; all I
have to do is implement it in java.
Have fun with it,
Andy
ps I'm serious about the declaration at the top. I'm not looking for
easy answers here, I just thought you might be interested :)
- Next message: kevin: "Re: Need help on Math Calculation with Java"
- Previous message: Roedy Green: "Re: "Global" variables using static class"
- In reply to: Roedy Green: "Re: recursive classes"
- Next in thread: Roedy Green: "Re: recursive classes"
- Reply: Roedy Green: "Re: recursive classes"
- Reply: John C. Bollinger: "Re: recursive classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|