-
Jul 30th, 2009, 08:59 AM
#1
Thread Starter
Hyperactive Member
Pseudocode and algo of this problem
Hi,
Can anyone got the exact solution for this problem?
"A pet shop needs to find out when they will run out of space to house thier rabbits. They are starting with a single pair of adult rabbits. It is known that after the first 3 months, each pair of rabbit will produce an average of two rabbits every 3 months. The shop has room to house 100 rabbits. Calculate when they will run out of space. (Assume no rabbits sold or die.)"
This question is asked to me with my friend..he ask me to give an answer or idea about that,,...but i really dont have an idea hahaha...lol..
VB 6.0 = "Self-Study" Then
vb.NET = "Self-Study" Then
C# = 'on going study.....
-
Jul 30th, 2009, 09:15 AM
#2
Re: Pseudocode and algo of this problem
Has anybody got any pocorn? I'm looking forward to watching this one.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Jul 30th, 2009, 09:32 AM
#3
Fanatic Member
Re: Pseudocode and algo of this problem
Originally Posted by FunkyDexter
Has anybody got any pocorn? I'm looking forward to watching this one.
-
Jul 30th, 2009, 02:54 PM
#4
Fanatic Member
Re: Pseudocode and algo of this problem
Originally Posted by dr_aybyd
Hi,
Can anyone got the exact solution for this problem?
"A pet shop needs to find out when they will run out of space to house thier rabbits. They are starting with a single pair of adult rabbits. It is known that after the first 3 months, each pair of rabbit will produce an average of two rabbits every 3 months. The shop has room to house 100 rabbits. Calculate when they will run out of space. (Assume no rabbits sold or die.)"
This question is asked to me with my friend..he ask me to give an answer or idea about that,,...but i really dont have an idea hahaha...lol..
It appears you're saying the population doubles every 3 months. So 4 rabbits at end of 3 months. 8 rabbits at end of 6 months. 16 rabbits at end of 9 months. 32 rabbits at end of 12 months. 64 rabbits at end of 15 months and 128 rabbits at end of 18 months. They would have run out of space after 15 months and before 18 months came around.
Make as many mistakes as you can as quickly as you can. We want to make sure that we make a great enough number of mistakes in a given amount of time so that we can be successful.
"Persistence is the magic of success." Paramahansa Yogananda
-
Jul 30th, 2009, 03:31 PM
#5
Re: Pseudocode and algo of this problem
Originally Posted by dr_aybyd
Hi,
Can anyone got the exact solution for this problem?
"A pet shop needs to find out when they will run out of space to house thier rabbits. They are starting with a single pair of adult rabbits. It is known that after the first 3 months, each pair of rabbit will produce an average of two rabbits every 3 months. The shop has room to house 100 rabbits. Calculate when they will run out of space. (Assume no rabbits sold or die.)"
This question is asked to me with my friend..he ask me to give an answer or idea about that,,...but i really dont have an idea hahaha...lol..
Will the offsprings always a pair (male and female)?
-
Jul 30th, 2009, 04:32 PM
#6
Fanatic Member
Re: Pseudocode and algo of this problem
Fortunately, the shop is doing so well they will be able to expand anytime they see fit therefore, the question is MOOT!!!
Turn that in and see what happens.
Here's to us!
Who's like us?
Darned few, and they're all dead!
-
Jul 30th, 2009, 05:55 PM
#7
Thread Starter
Hyperactive Member
Re: Pseudocode and algo of this problem
Originally Posted by dee-u
Will the offsprings always a pair (male and female)?
it is not specify if it is always male and female..
Last edited by dr_aybyd; Jul 30th, 2009 at 06:55 PM.
VB 6.0 = "Self-Study" Then
vb.NET = "Self-Study" Then
C# = 'on going study.....
-
Jul 30th, 2009, 06:29 PM
#8
Re: Pseudocode and algo of this problem
It's just a binary sequence. The question comes in many forms. You can find the answer by brute force approach. Just start with two, and keep multiplying by two until you exceed the capacity. At that point, the number of iterations - 1 is your answer (unless you want to deal with the fraction of an interval between 64 and 100).
My usual boring signature: Nothing
-
Jul 30th, 2009, 09:06 PM
#9
Re: Pseudocode and algo of this problem
Code:
If Rabbits > 1{
PetShop.Open
While Rabbits <= HalfCapacity {
Rabbits++ Rabbits
Months++ 3
}
PetShop.Close
Restaurant.Open
}
-
Aug 6th, 2009, 07:42 AM
#10
Re: Pseudocode and algo of this problem
Fortunately, the shop is doing so well they will be able to expand anytime they see fit
Clearly not, they're not selling any rabbits.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Aug 6th, 2009, 10:57 AM
#11
Fanatic Member
Re: Pseudocode and algo of this problem
Their business model is based on diversity, there is a huge market for cute little monkeys and baby alligators. The question remains moot.
Here's to us!
Who's like us?
Darned few, and they're all dead!
-
Aug 6th, 2009, 12:18 PM
#12
Re: Pseudocode and algo of this problem
This pet shop musn't know a lot about rabbits, too. To make it realistic, you've go to expand the problem:
1) A female can beome pregnant at 3 months of age.
2) A female can have anywhere between 2 and 8 per litter, with any percentage of that as female.
3) Litters have a 1 month gestation period.
4) The female can become pregnant again after the litter is born.
So then the real question becomes this:
How many rabbits can the cage hold until the cost of feeding, healthcare, and cleaning becomes unsustainable?
From my burrow, 2 feet under.
-
Aug 7th, 2009, 03:36 PM
#13
Fanatic Member
Re: Pseudocode and algo of this problem
Here's to us!
Who's like us?
Darned few, and they're all dead!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|