# 算法设计代写 | CSDS 293 Software Craftsmanship Programming Assignment 6

## Assignment

In this assignment, you will design an algorithm to arrange paintings
in a display.

The Western Reserve Auction House has been asked to carry out the
auction of paintings by Picasso and Dalí. As an intern at the Auction
House, you are tasked to design an algorithm to arrange the
paintings so that they can be viewed in the days leading to the
auction. The curators have given you the following rules:

• The paintings will be arranged in two rows, with the Picassos
in front and the Dalís in the back. Each Dalí has exactly one
Picasso in front of it, and each Picasso has exactly one Dalí
behind it.

• The Picasso (in front) must be shorter than the Dalí (behind
it).

• The paintings should be arranged in non-decreasing order of
price from the left to the right. Paintings of the same price can
be arranged in any order as long as the Picasso is shorter than
the Dalí.

• There are n Picassos and n Dalís.

• As many paintings should be displayed as allowed by the
previous rules. It is possible that the rules do not allow any
display, in which case the algorithm should say so.

Your algorithm should be correct and as fast as you can make it.
However, the curators did not give you any explicit run time target.
Submit:

• An overview of the algorithm with a narrative section and
explanatory diagrams,

• The pseudo-code of your algorithm. You should state the
classes to which each method belongs and explain the
abstraction that your classes and your methods capture,

• A justiﬁcation for the algorithm’s correctness,

• An analysis of its running time, and

• A few examples of the algorithm operation.

It is your job to specify the representation and format of the
arguments, such as the heights and prices of the paintings. Your
submission will be evaluated in part on the adherence of argument
representation to good craftsmanship principles. Your algorithm
should be written as a ﬂexible package that can be reused in other
projects, and thus should avoid using any explicit form of input and
output.

No implementation is required: you will implement your pseudo-
code in the next programming assignments. After this assignment,
you will not be allowed to make major changes to the pseudo-code.

Although it is only required for the programming assignment 7, you
can start early with the installation of the CSDS 293 development
environment. The server environment is described on Canvas in the
git module under “Server Setup”. Please, note that the CSDS 293 staﬀ
does not support Windows: alternative options are covered on
Canvas in the Syllabus section under “Windows”.