Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

mathematic combination of steps
I have a problem like this,...

I have a pigeon hole like the below
X is where the pigeon stay
Y is where the pigeon want to go..

The rules is X can only move 1 step to the right at anytime
for the diagram below.. X can 3 choice of movement.
when x reach column 2 x can have N choices of movement depend on the choice
of first movement,... and so and so...


[ ]
[ ][ ][ ]
[ ][ ][ ][ ][ ]
[X][ ][ ][ ][ ][ ][Y]
[ ][ ][ ][ ][ ]
[ ][ ][ ]
[ ]

the Question is
How many route X can take to go to Y ?

and

If I enlarge the pigeon hole with more holes but shape the same

how could I formulate a formula to count the number of ways X can go to Y ?



Regards,
Ray

- I am mathematically dumb... anyone could help me !

Report this thread to moderator Post Follow-up to this message
Old Post
Ray
11-08-04 01:55 PM


Re: mathematic combination of steps
"Ray" <nibanna@gmail.com> wrote in message
news:1759ba58.0411080056.1af4280e@posting.google.com...
> I have a problem like this,...
>
> I have a pigeon hole like the below
> X is where the pigeon stay
> Y is where the pigeon want to go..
>
> The rules is X can only move 1 step to the right at anytime
> for the diagram below.. X can 3 choice of movement.
> when x reach column 2 x can have N choices of movement depend on the
choice
> of first movement,... and so and so...
>
>
>                 [ ]
>              [ ][ ][ ]
>           [ ][ ][ ][ ][ ]
>        [X][ ][ ][ ][ ][ ][Y]
>           [ ][ ][ ][ ][ ]
>              [ ][ ][ ]
>                 [ ]
>
> the Question is
> How many route X can take to go to Y ?
>
> and
>
> If I enlarge the pigeon hole with more holes but shape the same
>
> how could I formulate a formula to count the number of ways X can go to Y
?
>
>
>
> Regards,
> Ray
>
> - I am mathematically dumb... anyone could help me !

I am not sure what this has to do with compression, but the problem can be
solved by dynamic programming.  Put a 1 in the leftmost hole.  Then working
left to right, put in each hole the sum of the 3 boxes to the left, upper
left and lower left.  This is the number of paths to that hole.  Note that
all of the holes to the left of the diamond will be 0, and all holes to the
right don't need to be computed.  You end up with this:

1
1 3 10
1 2 6 16 45
1 1 3 7 19 51 141
1 2 6 16 45
1 3 10
1

So for this case the answer is 141, and you can use this algorithm for any
size array.

There might be a closed form solution, but I don't know of one.

-- Matt Mahoney



Report this thread to moderator Post Follow-up to this message
Old Post
Matt Mahoney
11-08-04 08:55 PM


Re: mathematic combination of steps
"Matt Mahoney" <matmahoney@yahoo.com> wrote in message
news:X5Ojd.8678$Gm6.6010@newsread3.news.atl.earthlink.net...
> "Ray" <nibanna@gmail.com> wrote in message
> news:1759ba58.0411080056.1af4280e@posting.google.com... 
> choice 
Y
> ? 
>
> I am not sure what this has to do with compression, but the problem can be
> solved by dynamic programming.  Put a 1 in the leftmost hole.  Then
working
> left to right, put in each hole the sum of the 3 boxes to the left, upper
> left and lower left.  This is the number of paths to that hole.  Note that
> all of the holes to the left of the diamond will be 0, and all holes to
the
> right don't need to be computed.  You end up with this:
>
>         1
>       1 3 10
>     1 2 6 16 45
>   1 1 3 7 19 51 141
>     1 2 6 16 45
>       1 3 10
>         1
>
> So for this case the answer is 141, and you can use this algorithm for any
> size array.
>
> There might be a closed form solution, but I don't know of one.

There is.  I searched on the sequence and found this:
http://www.research.att.com/cgi-bin...nces/eismum.cgi

-- Matt Mahoney



Report this thread to moderator Post Follow-up to this message
Old Post
Matt Mahoney
11-08-04 08:55 PM


Re: mathematic combination of steps
"Matt Mahoney" <matmahoney@yahoo.com> wrote in message
news:YmOjd.8728$Gm6.1542@newsread3.news.atl.earthlink.net...
>
> "Matt Mahoney" <matmahoney@yahoo.com> wrote in message
> news:X5Ojd.8678$Gm6.6010@newsread3.news.atl.earthlink.net... 
to
> Y 
be 
> working 
upper 
that 
> the 
any 
>
> There is.  I searched on the sequence and found this:
>
http://www.research.att.com/cgi-bin...nces/eismum.cgi

That didn't work.  Try http://www.research.att.com/~njas/sequences/ and
search for 1 1 3 7 19 51 141

-- Matt Mahoney



Report this thread to moderator Post Follow-up to this message
Old Post
Matt Mahoney
11-09-04 01:55 AM


Re: mathematic combination of steps
"Matt Mahoney" <matmahoney@yahoo.com> wrote in message news:<YmOjd.8728$Gm6.1542@newsread3.
news.atl.earthlink.net>...
> "Matt Mahoney" <matmahoney@yahoo.com> wrote in message
> news:X5Ojd.8678$Gm6.6010@newsread3.news.atl.earthlink.net... 
>  choice 
>  Y
>  ? 
>  working 
>  the 
>
> There is.  I searched on the sequence and found this:
> [url]http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eismum.cgi[/url
]
>
> -- Matt Mahoney


Thanks Matt.


You had helped alot. I was trying to move pigeon in pigeon hole...
Matt, where you study mathematics ? could you teach me ? pls... I
never got more then 60 marks in school. and even worse now.. I am
working.




Regards,
Ray


- we rejoice a smaller world :)

Report this thread to moderator Post Follow-up to this message
Old Post
Ray
11-09-04 01:55 AM


Re: mathematic combination of steps
"Ray" <nibanna@gmail.com> wrote in message
news:1759ba58.0411081715.32012245@posting.google.com...
> "Matt Mahoney" <matmahoney@yahoo.com> wrote in message
news:<YmOjd.8728$Gm6.1542@newsread3.news.atl.earthlink.net>... 
to 
can be 
upper 
that 
to 
any 
http://www.research.att.com/cgi-bin...nces/eismum.cgi 
>
>
> Thanks Matt.
>
>
> You had helped alot. I was trying to move pigeon in pigeon hole...
> Matt, where you study mathematics ? could you teach me ? pls... I
> never got more then 60 marks in school. and even worse now.. I am
> working.

Well, yes, if you were going to Florida Tech., but I teach mostly
programming.

-- Matt Mahoney



Report this thread to moderator Post Follow-up to this message
Old Post
Matt Mahoney
11-10-04 01:55 AM


Re: mathematic combination of steps
"Matt Mahoney" <matmahoney@yahoo.com> wrote in message news:<aWbkd.10272$Gm6.3700@newsread3
.news.atl.earthlink.net>...
> "Ray" <nibanna@gmail.com> wrote in message
> news:1759ba58.0411081715.32012245@posting.google.com... 
>  news:<YmOjd.8728$Gm6.1542@newsread3.news.atl.earthlink.net>... 
>  choice 
>  to 
>  can be 
>  working 
>  upper 
>  that 
>  to
>  the 
>  any 
>  [url]http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eismum.cgi[/ur
l] 
>
> Well, yes, if you were going to Florida Tech., but I teach mostly
> programming.
>
> -- Matt Mahoney

okay... if I do well in my work maybe I can have enough money to go there.. 
lol
anyway.. thanks.. I am a programmer too, a c/c++ programmer in mobile networ
k field.


Regards,
Ray

Report this thread to moderator Post Follow-up to this message
Old Post
Ray
11-10-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compression archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:48 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.