prog1 - COP 3503H Programming Assignment #1 Fall 2002...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Title: “Program Assignment 1: Analyzing Program Performance” Points: 100 points – 60pts for coded portion, 40 points for written analysis Due Date: Wednesday September 25, 2002 Objectives: (1) To reinforce the concepts underlying the asymptotic analysis of a program’s performance behavior. (2) Begin to program in Java. Description: Create a Java program that produces the necessary data to determine the asymptotic behavior of three different algorithms that perform operations on matrices. Do this according to the steps shown below. 1. Create 2 randomly filled matrices (see below for the details). You will need to experiment with the sizes of the two matrices so that you get non-zero execution times – see below. Start with 25 x 25 square matrices and work upwards until each algorithm gives a non-zero execution time for a given size of the matrices. 2. Determine the execution time required to run each of the algorithms given below on 5 different size matrices where each size gives a non-zero execution time. Thus you will generate at total of fifteen different timing values, five for each algorithm. Note: while your program must correctly compute the values for these three matrix operations, you do not need to include this in your output, although you should verify that the algorithms are executing properly. (See below for more details on matrix operations.) Algorithm #1 – Matrix Addition for (i = 0; i < n; i++) for (j = 0; j < n; j++) A[i][j] = B[i][j] + C[i][j]; Algorithm #2 – Matrix Multiplication for (i = 0; i < n; i++) for (j = 0; j < n; j++) for (k = A[i][j] = 0; k < n; k++) A[i][j] += B[i][k] * C[k][j]; Algorithm #3 – Matrix Transposition for (i = 0; i < n-1; i++) for (j = i+1; j < n; j++){ temp = A[i][j]; A[i][j] = A[j][i]; A[j][i] = temp; } 3. Part 2 will produce 5 different time values for each of the three algorithms. Use these values
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 06/12/2011.

Page1 / 7

prog1 - COP 3503H Programming Assignment #1 Fall 2002...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online