Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Pathfinding partitions A Ferrers board is a way of representing a partition, ( a 1 , a 2 , dots, a k ) as a
Pathfinding partitions
A Ferrers board is a way of representing a partition, dots, as a set of rows of
dots, where the row has dots. For example, the partition is represented
by the following Ferrers board
We could choose one of the columns of the Ferrers board, remove it and replace it with
a row of the same length as shown below.
becomes
Call such a rearrangement a move. The purpose of this tude is to find a sequence of
moves that will transform one partition into another, whenever this is possible.
task:
Write a program that takes input from stdin a data file formatted according to the rules
of the Parsing Partitions tude where each scenario in the file will consist of exactly two
partitions of the same integer.
The output to stdout should be in standard form and represent the solution to each
scenario, ie a shortest sequence of moves that transforms the first partition to the
second. Each scenario in the output should be in standard form and should start with
a comment line of the form:
# Moves required:
with a suitable replacement for This should be followed by
a sequence of lines, starting with the first partition, and ending with the last, so that
each line is obtained from the previous one by a move, and the number of moves used
is minimal. In the event that no such sequence of moves exists, the output should start
with:
# No solution possible
followed just by the two given partitions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started