reflection - Also, the elementAt and setElementAt methods...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Alex Packard Matrix Assignment Reflection: In my implentation of the matrix assignment, I used a 2D array of Numbers to represent the matrix. However it is possible to u s one-dimensional array. In order to do this, there would need to be a few changes to the 2D array implentation. Obviously, yo u need to initilize a one-dimensional array instead of a 2D array. The size of this array would be determined by multiplying the n u of rows and columns specified to the constructor.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Also, the elementAt and setElementAt methods would need to be changed. methods are now dealing with a one-dimensional array, it can only take one parameter. In order to calculate the location of th e you are looking for, simply multiply the specified row by the width of the matrix and add the number of columns as shown belo w y public int elementAt(int row, int col) throws IndexOutOfBoundsException { return this.entry[row * width + col] }...
View Full Document

This note was uploaded on 04/08/2008 for the course HIST 101 taught by Professor Wormer during the Spring '08 term at Rensselaer Polytechnic Institute.

Ask a homework question - tutors are online