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 4-grid 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 node-naming convention: we name the nodes
This is the end of the preview. Sign up
access the rest of the document.
This note was uploaded on 02/22/2011 for the course CS 1112 taught by Professor Dr.d during the Fall '11 term at McMaster University.