This preview shows page 1. Sign up to view the full content.
CS2ME3
Assignment 1 due on February 17
Winter 2011
You are encouraged to work in groups of two or three. If you cannot ﬁnd partners, you can
work alone. Please submit
one
copy of the assignment; if you are working with partners, all
names should appear on the assignment. Submit using
subversion
. Note that you will get
a grade of zero if your program does not run.
Write a Python program that takes as input the description of a grid, and outputs its minimum
cost spanning tree. An
n
grid is a graph consisting of
n
2
nodes, organized as a square array
of
n
×
n
points. Every node may be connected to at most the nodes directly above and below
(if they exist), and to the two nodes immediately to the left and right (if they exist). An
example of a 4grid is:
◦
4
◦
3
◦
15
◦
1
◦
1
9
◦
1
2
◦
1
◦
23
◦
5
7
◦
6
◦
3
◦
3
◦
4
◦
◦
7
◦
Note that it has 4
2
= 16 nodes, and 17 edges. What is the largest number of edges that
an
n
grid may have? We have the following nodenaming convention: we name the nodes
This is the end of the preview. Sign up
to
access the rest of the document.
 Fall '11
 Dr.D

Click to edit the document details