University of Nevada Las Vegas
Howard R. Hughes College of
Engineering
School of Computer Science
My Home Page
UNLV CS Spring 2007 Assignment 7

CS 302 Assignment 7
Due date: Tuesday, March 20, 2007, midnight.
All programming assignments must be
submitted electronically.
Submit them to the graduate assistant,
James Oravec,
on or before the due date.
All written assignments must be handwritten
(not typed or printed from a
computer file) in your own handwriting, on 8.5 by 11 inch paper, or on A4
paper. Write your name on each sheet, and do not fold the pages or crimp the
corners. (You may use a paper clip or a staple.)
-
Input a list of exactly 1024 integers, and store them in an array A.
(You can give the array any name; it need not be "A".)
-
Your program should contain several functions, each of which
does a specific task using A as a parameter.
-
You should have a single output file that does each of those
tasks.
-
Here are the functions you need.
-
A function which returns the sum of the entries of A.
-
A function which returns the maximum value of the entries of A.
-
A function which returns the beginning and end indices of
the subarray of A which has the largest total.
This problem is introduced as the maximum subsequence sum problem
on page 52 of your textbook.
-
A function which computes the greatest common divisor of the entries
of A, using
Euclid's algorithm. (You will need another helper
function which computes the greatest common divisor of two integers.)
-
A function which finds and prints onto output the longest strictly
monotone increasing subsequence of A. Some websites:
-
Here is an example input file.
-
Here is an much smaller example
of size 32 to practice on.
