A computer programmer lives in his home located at the upper left corner of the following street grid and works in a building located at the right lower corner. In the grid, lines represent streets. There are five horizontal streets and seven vertical streets. On his way to work, he can drive along any street and turn at any intersection, but can only go down or right, and cannot go back. How many different paths are there for him to drive from home to work? Describe your algorithm, define all variables, write down the recurrent formulas and boundary conditions to solve this problem, and show your calculation to find the total number of paths for this question. A correct number with no formula and calculation may receive a zero score.
(The grid wouldnt post but it is a simple 4 X 6 grid)
Here is the solution for the following problem. Since you did not mention the language, I am providing you solution in C++.
If you want the solution in another language please feel free to ask.
There are five horizontal streets and seven vertical
streets.
It means we have a matrix of : 5 x 7 grid
---------------------------------------------------------------------------------------------------------------------------------------------
Constraint: Can only move right or in down direction
----------------------------------------------------------------------------------------------------------------------------------
Variable used : rows //store the number of rows
cols // store the column in grid
totalPaths //store total number of paths
-----------------------------------------------------------------------------------------------------------------------------------------
Boundry Condition:
Start from the destination and if reaches at the source , count it as a path
At source the row = 1 and col = 1
// If either given row number is first or given column number is
first
if (m == 1 || n == 1)
return 1;
-------------------------------------------------------------------------------------------------------------------------------------
Code:
#include<iostream>
using namespace std;
int numberOfPaths(int m, int n)
{
// If either given row number is first or given column number is
first
if (m == 1 || n == 1)
return 1;
return numberOfPaths(m - 1, n) + numberOfPaths(m, n - 1);
// + numberOfPaths(m-1, n-1);
}
int main()
{
int rows = 5;
int cols = 7;
int totalPaths = 0;
totalPaths = numberOfPaths(rows, cols);
cout << "Number of Paths: " << totalPaths;
return 0;
}
-----------------------------------------------------------------------------------------------------------------------------------
Output:
A computer programmer lives in his home located at the upper left corner of the following...
Need help with this for practice! Please answer swiftly or I
will not upvote.
A computer programmer lives in his home located at the upper
left corner of the street grid pictured here and works in a
building located at the lower right corner. The pictured grid's
lines represent streets. On his way to work, the programmer drives
along any street and can tyen at any intersection but can only go
down or right and cannot go back. How many...
I need some help creating C++ Left, Center, Right (LCR) dice game Pseudocode. Address the following : A. Analyze the given problem statement. B. Break the problem down into distinct steps of pseudocode that will solve the problem. C. Create variables to track the various elements in the pseudocode. D. If applicable, determine any breakdown of pseudocode into functions and/or classes. E. Use natural language to work through the problems. Using three special dice and player pieces called chips. In...
Paul J. and Judy L. Vance are married and file a joint return. Paul is self- employed as a dentist, and Judy is a college professor. Paul and Judy have two children. The oldest is Vince who lives at home. Vince is a law student at the University of Cincinnati and worked part-time during the year, earning $1,500, which he spent for his own support. Paul and Judy provided $6,000 toward Vince’s support. Jennifer is the youngest and lived in...
Required information [The following information applies to the questions displayed below.] Read the following letter and help Shady Slim with his tax situation. Please assume that gross income is $172,900 (which consists only of salary) for purposes of this problem. December 31, 2018 To the friendly student tax preparer: Hi, it’s Shady Slim again. I just got back from my 55th birthday party, and I’m told that you need some more information from me in order to complete my tax...
Shady Slim / Comprehensive
Deductions Problem Read the following letter and help Shady Slim
with his tax situation. Assume that gross income is $172,900 (which
consists only of salary) and ignore AGI thresholds for purposes of
this problem. December 31, 2020 To the friendly student tax
preparer: Hi, it’s Shady Slim again. I just got back from my 55th
birthday party, and I’m told that you need some more information
from me in order to complete my tax return. I’m...
52. Read the following letter and help Shady Slim with his tax situation. Please assume that his gross income is $172,900 (which consists only of salary) for purposes of this problem. December 31, 2019 To the friendly student tax preparer: Hi, it's Shady Slim again. I just got back from my 55th birthday party, and I'm told that you need some more information from me in order to complete my tax return. I'm an open book! I'll tell you whatever...
You might be familiar with Crazy Eddy, an owner of the “Crazy Eddy’s” home electronics stores that used to exist when you were younger (though maybe too young to remember). Some of the larger superstores like Best Buy and Circuit City moved in and began squeezing Eddy. As it turned out his tagline, “where the prices are insane,” was quite true, and he was forced out of business. Unbeknownst to many, Eddy was an avid skier, and his desire to...
Rush Inuit is an impulsive, fly-by-the-seat-of-his-pants kind of guy. His best friend, Stu Earley, is the exact opposite – cautious and reluctant. The two are recent UNCG graduates who roomed together all … ahem … eight years. You know who they are even though they graduated last year because everyone on campus knows Rush and Stu – they’re legends on the social scene. To make ends meet during college, Rush and Stu organized fun trips to exciting destinations and charged...
Comprehensive Problem 6-52 (LO 6-1, LO 6-2, LO 6-3)
[The following information applies to the questions
displayed below.]
Read the following letter and help Shady Slim with his tax
situation. Please assume that his gross income is $172,900 (which
consists only of salary) for purposes of this problem.
December 31, 2019
To the friendly student tax preparer:
Hi, it’s Shady Slim again. I just got back from my 55th birthday
party, and I’m told that you need some more information...
Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the following case study : You have recently been hired as an HR Consultant in the new HR Department of Outrage Video Games. Outrage is a five year old, upstart company, run by two very bright young men - Will Bates – President, and his best friend Steve Cobbs, Vice President. This is a very exciting change for you because Outrage, which literally started in...