AllRounder.ai
Chapters in this course

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.

Enrol free

1.3. Paths with a Blocked Intersection

Interactive Audio Lesson

Session 1: Introduction to Grid Paths

Unlock the classroom podcast

The transcript is free to read. A free account plays the conversation back.

Sarah
SarahInstructor

Let’s start our discussion about grid paths! Can anyone tell me what we mean by paths in a grid?

Noah
Noah

Are those the different ways we can move from one corner of the grid to the opposite corner?

Sarah
SarahInstructor

Exactly! In a rectangular grid, we can move either right or up. If we start at (0,0) and aim to reach (m,n), we have to make 'm' moves to the right and 'n' moves up.

Isabella
Isabella

So how do we figure out how many different ways we can do that?

Sarah
SarahInstructor

Great question! We calculate this using combinations. The total number of moves you need to make is 'm+n' and then you can choose positions for the 'm' right moves, which gives you C(m+n,m)C(m+n, m).

Akash
Akash

And what does CC stand for?

Sarah
SarahInstructor

Good catch! C(n,k)C(n,k) represents combinations, which is the number of ways to choose 'k' items from 'n' items. In our case, that's how we calculate the paths.

Ananya
Ananya

So if we have a 5 column and 10 row grid, how many paths are there?

Sarah
SarahInstructor

That would be C(15,5)=3003C(15, 5)=3003. So remember, the formula is key here!

Sarah
SarahInstructor

To summarize: We can calculate paths using combinations and learn that in a grid with 'm' columns and 'n' rows, total paths are C(m+n,m)C(m+n, m).

Session 2: Blocked Intersections

Unlock the classroom podcast

The transcript is free to read. A free account plays the conversation back.

Robert
RobertInstructor

Now, let’s talk about what happens when there are blocked intersections, like (2,4). What do we do then?

Noah
Noah

Do we just exclude the paths that go through that intersection?

Robert
RobertInstructor

Exactly! We can calculate how many paths go through the blocked intersection and then subtract that from the total. But first, can anyone tell me how to find paths passing through (2,4)?

Isabella
Isabella

We would need to find paths from (0,0) to (2,4) and then from (2,4) to (5,10).

Robert
RobertInstructor

Correct! So we compute the two segments: C(6,2)C(6,2) for the first segment and C(9,3)C(9,3) for the second.

Akash
Akash

And then we multiply those two values together to find all paths that pass through that point?

Robert
RobertInstructor

Right! So if we multiply these, we would calculate the invalid paths and to compute the valid paths, we perform: total paths minus these invalid ones. What do we end up with if the total is 3003 and invalid paths are 1260?

Ananya
Ananya

That would be 1743 remaining valid paths!

Robert
RobertInstructor

Exactly! Well done! So remember, counting invalid paths helps us filter out valid paths in grids with blocked intersections.

Robert
RobertInstructor

In summary: Blocked intersections require us to calculate invalid paths through them and subtract from the total. We keep adjusting our calculations based on new blocks entering the picture.

Session 3: Multiple Blocked Intersections

Unlock the classroom podcast

The transcript is free to read. A free account plays the conversation back.

Sarah
SarahInstructor

Now that we’ve tackled single block paths, what happens if we have two blocked intersections? For example, (2,4) and (4,4)?

Noah
Noah

Wouldn't we just add blocked path counts together?

Sarah
SarahInstructor

That's a common mistake! We need to subtract paths through both intersections because we’ll end up counting some paths twice. Can anyone tell me what that principle is called?

Isabella
Isabella

I think it’s inclusion-exclusion!

Sarah
SarahInstructor

Correct! We include individual blocked paths and exclude the paths traversing both blocks.

Akash
Akash

How do we find those paths that go through both?

Sarah
SarahInstructor

You’d compute the paths from (0,0) to (2,4) then to (4,4) and finally to (5,10). It’s a combination of three segments. Path count through both is then added back after subtraction. What’s our result if we calculate that?

Ananya
Ananya

So we learn to adjust our block counts to keep everything intact!

Sarah
SarahInstructor

Exactly! Always be cautious of double counts, using inclusion-exclusion helps us keep our math aligned. Well done!

Sarah
SarahInstructor

To recap: For multiple blocked intersections, use inclusion-exclusion to accurately calculate and adjust path counts.