Question: Design an algorithm to assemble a jigsaw puzzle. Assume that each piece has four sides, and that each pieces final orientation is known (top, bottom,

Design an algorithm to assemble a jigsaw puzzle. Assume that each piece has four sides, and that each piece’s final orientation is known (top, bottom, etc.). Assume that you have available a function

bool compare(Piece a, Piece b, Side ad)

that can tell, in constant time, whether piece a connects to piece b on a’s side ad and b’s opposite side bd. The input to your algorithm should consist of an n x m array of random pieces, along with dimensions n and m. The algorithm should put the pieces in their correct positions in the array. Your algorithm should be as efficient as possible in the asymptotic sense. Write a summation for the running time of your algorithm on n pieces, and then derive a closed-form solution for the summation.

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To design an algorithm to assemble a jigsaw puzzle efficiently we can use a technique similar to dep... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Practical Introduction To Data Structures Questions!