Is it possible to create a program using VB to do this:

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If someone could help me doing a code in VB to do the following:

The output should be a list of all posible ways in which (m) different Males
and (f) different female could be line up if no two females could be together
(one female can not stand after another female in the line).

Thanks for any suggestions,

EMG
 
Eduardo,

This sounds a lot of a part of a course or other kind of school. Most of us
in this newsgroup have made the agreement not to help with that.

Or can you explain more where you need this.

Sorry

Cor
 
Hi Cor,

I work for the government of PR, at a family planification center. During
this month we are having some advertising to make consience about how
important is the family role. We are working with some algorithms a work
member suggested to do to make some kind of game which will demonstrate some
significant output. We already got most of them. This one I posted has
taken us more than we thought to solve it. If you could help us with this
one, it will be apreciated .

Thanks,
 
Eduardo,

Is this something as you mean, the problem is that I made it deep in the
night with one bottle of brandy and after that did not know anymore how I
made it.

(It is in JavaScript, you can see it if you right click and than choise
source, although that is not all another part is in a file)

http://home.planet.nl/~ligth204/rootpag.htm?1670Dirk

It is very deep recursive.

Just to know better what you mean because this is JavaScript.

There are only individual records with tell who is the father and who is the
mother and nothing more.

Cor
 
Eduardo,
This really isn't a VB question so much as an algorithm question. You may
have better luck in a math oriented user group than in this one. The
language really wont matter once someone comes up with the algorithm. The
logic is the problem here, nto the syntax.

However, I think its an interesting challenge and will give ti some thought
to see if I can come up with an approach.

Anyway... my thoughts so far...
First, you need to know that the women do not outnumber the men by more than
1, or the task is impossible.

next, calculate the total number of possibilities for the order in which the
women (XX) line up by themselves. forget about them standing next to each
other, you will insert the men later.

then calculate the number of ways in which the men (XY) can line up by
themselves.

Now that you have two sets of outcomes, XX and XY, the product of which will
tell you how many possible outcomes you have if all the extra men line up at
the end of the line.

For each extra man you will have XX+1 possible places for the extra man to
stand (they can be in front of any of the women in line, or in the very
back).

This last piece will require a little more thought, but if you have done all
the other algorithms you probably have somethign that will work for this.

Please post your final algorithm, as this is an interesting problem.
 
I thoguht abotu this some mroe last night, and the final piece of the
algorith is definately the most complicated by far. From what I can figure
out you need two recursive functions, the first based on how many extra men
you have and the second based on the total number of women.

Where number of women = XX, number of men = XY, and number of extra men =
NN...
For XX=1 the number of possibilities = (NN + 1)
for XX=2 the number of possibilities = the sum of 1 to NN possibilities for
XX = 1

In the end the number of possibilities = the sum of 1 to NN possibilities
for (XX-1) and you will have to recursively call this until you get to XX =
1.

You will have to fogive my lack of proper notation, as it has been quite a
while since I had this sort of math in school.
 
I really thank you a lot for your time you dedicated to my question, I know
it is complicated.


Thankyou a lot,

Edd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top