cover me in ashes

lundi


(Trivial) Algorithm Question of the Day

A latin square is an n by n square that contains all n numbers from 1 to n in every column and every row. For example,

1 2 3
3 1 2
2 3 1

is a 3 by 3 latin square.

Define a latin rectangle as an m by n rectangle, m < n, such that in every row all n numbers are present, and in every column no two numbers are the same. e.g. a possible 2 by 4 latin rectangle is:

3 4 2 1
2 3 1 4

Give a polynomial time algorithm that given any valid m by n latin rectangle, will extend it (by adding rows, without modifying the original rows in the latin rectangle) to form a valid n by n latin square.

No linear programming needed.

posted by ncmhp @ 15.5.06

covermeinashes : a syndicated collective

covermeinashes is:
anodyne. wayward wordsmith latter day aesculapius.
ncmhp. ....
fcs
.
tormented lover poet bard.

diversions

contrails

Powered by Blogger