N-Piece Problem Flashcards

nxn board with n pieces (21 cards)

1
Q

When the pieces are the same, how many solutions are there?

No constraints

Pieces can stack, be in the same row/column/diagonal

A

Fewer than n^2n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When the pieces are the different, how many solutions are there?

No constraint

Pieces can stack, be in the same row/column/diagonal

A

n^2 * n^2 * … * n^2 = n^2n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When the pieces are the same, how many solutions are there?

Pieces cannot stack

A

C(n^2, n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When the pieces are different, how many solutions are there?

Pieces cannot stack

A

C(n^2, n) n!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When the pieces are the same, how many solutions are there?

Pieces must be in different rows

A

n * n * … * n = n^n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When the pieces are different, how many solutions are there?

Pieces in different rows

A

n^n n!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When the pieces are the same, how many solutions are there?

Pieces in different rows and columns

A

n * (n-1) * (n-2) * … *1 = n!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When the pieces are different, how many solutions are there?

Pieces in different rows and columns

A

n! n! = (n!)^2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Brute Force approach to solving this problem?

A

Create all possible assignments, iteratively check if the assignments follow the constraints

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When could the Bruce Force approach be useful?

A

If you only need one solution to the problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the Algorithmic approach to this problem called?

A

Searching a State Space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the approach for one solution?

A

Fast forward to the first solution, i.e. make choices that favor reaching the solution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the approach for ALL solutions?

A

Prune as many branches as possible, i.e. make choices that favor breaking constraints

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the goal of Search State Space?

A

An efficient, methodical search through the complete and partial state spaces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the most efficient approach for Search State Space?

A

Checking constraints with previously assigned pieces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the first thing that happens IN THE CODE when solving the n-piece problem?

A

Check if done, and attempt the next assignment j = a[i] + 1

17
Q

What happens if j > n-1?

A

The placement for i is reset, we backtrack to the previous row

18
Q

What happens if the current placement conflicts with a previous one?

A

Move to the next column placement

19
Q

What happens when i >= n-1?

A

We’ve reached the last row, increase the complete counter EVEN IF THERE ARE CONFLICTS

Log the solution ONLY IF there are no conflicts

20
Q

What happens if we want ALL the solutions?

A

Log the current solution, and continue looping

21
Q

What is this kind of search algorithm called?

A

Exhaustive Search