[A+DS] >>>prac 2>>>

CSE2304, Prac' 1, week 2, 8-12 March 1999

also CSC2040, CSE2324, CSE3324, CSC2240 and CSC3240

The course CSE2391/CSE3391 Unix Tools is on advanced uses of Unix, but it does contain some pointers to introductory material: [web].

Everyone has a lab' in week 2. The purpose is to become familiar with the lab' equipment and the Linux / Unix operating system.

From Lab #2, weeks 3 and 4, onwards, groups A and B alternate.

Tasks:

  1. Create a subdirectory for work related to this course, and a subdirectory within that for this prac'.
  2. Produce a C program to solve the following simple(?) problem (you will need to prepare the algorithm before the lab'):
    1. Read in a sequence of integers, n1, n2, ..., nm, from standard input, the numbers being separated by white space (spaces or newlines) and terminated by the end-of-file. You can assume that they will fit in a large array that you might allocate.
    2. Find the maximum sum interval, <i,j>, s.t. SUMk=i..j nk is as large as possible.
    3. Print i, j and the sum of the interval.
    4. e.g.If the input is: 3 -4 -2 2 2 -3 4 -5 2 1, then the interval is <4,7> and its sum is 5.
  3. Produce a set of important data test-cases that test the program as thoroughly is possible.
  4. Investigate and/or describe how the running-time of the program varies with `m', which might be very large, or with other properties of the data or the output.

There are no marks for this exercise, but attendance is compulsory, and you will almost certainly be in difficulties in following weeks if you do not complete this lab'. The demonstrators will give you feedback on what they will be looking for in future, marked exercises.

Useful commands:



L.Allison, Comp. Sci. and S.W.E., Monash University, Australia.