Question: An n - polyomino is a plane shape formed by joining n 1 1 squares edge to edge without overlapping. Three data structures can be
An polyomino is a plane shape formed by joining squares edge to edge without overlapping.
Three data structures can be designed to represent a polyomino:
A Use a twodimensional array of digits, where and are the minimum length and width
that need to be used for storing the polyomino.
B Use a sequence of relative locations from any square within the shape.
C Use a tree representation with a clockwise preorder traversal. That is we will treat each
square in the polyomino as a node on the tree. One square will become the root of the tree. For
each of the rest squares, we assign one neighboring edgesharing square as its parent. For each
square on the tree, we will use a bit indicator that depicts which neighboring cells are connected
to it in the tree. Finally, you record down these bit indicators of all tree nodes under a preorder
traversal.
Problem :
In this problem, we consider free polyominoes. That is two npolyominos are
considered identical under translation, rotation, and flipping. Devise an efficient
algorithm such that, given two npolyominoes and test if and are
identical. Give a correctness proof and analyze the running time.
Hint: You may notice that we did not specify the "data structure" that represents
the input polyominoes. In the real world, this is indeed part of the algorithm
design when you are solving a relatively more complicated problem. Make sure
you specify which representation to use in your solution. le choose the input
spec wisely. If you asked me I would choose the representation B from the
previous problem as the input format.
Problem :
Devise an algorithm such that, given an integer generates and counts all
distinct shapes of npolyominoes. Give a correctness proof and analyze the
running time. Is your algorithm an exponential time algorithm? why or why not?
Hint: I will choose the representation C this time. Perhaps, we need a
subroutine that translates representation C to representation B so that the
algorithm you have developed from problem can be applied.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
