Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
2.2.2. Row by Row Computation
This section
Practice test
11 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
3 cards from this lesson. Good the night before a test.
Try these first
- 1.
If you are at (0,0), how many paths are there to (0,0)?
Hint
Consider what it means to stay in the same place.
- 2.
Name two ways you can reach the point (2,1) in a grid starting from (0,0).
Hint
Think about moving in increments of 1.
- 3.
What is the formula for calculating paths to point (i,j) in a grid?
Hint
Think about where you can move to reach (i,j).
- 4.
True or False: In a grid with holes, all path values are affected by zero values.
- True
- False
Hint
Consider the flow of paths in relation to holes.
- 5.
Given a 5x5 grid with holes at (2,2) and (3,3), write a function to compute paths from (0,0) to (4,4) programmatically. Show your results for multiple layouts of holes.
Hint
Map out the grid with a two-dimensional array for ease.
- 6.
Describe a scenario where using memoization might fail compared to dynamic programming when adding complexity (like adding more holes or larger grid sizes).
Hint
Consider performance and time with increasing complexity in problem.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
1 more question available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting