Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Assignment 1 - Question 4
March 24, 2006 09:26AM
Question 4 for assignment 1 has us finding the minimum and maximum values in a list, no problems there, but it also states:

"If the list contains more than n elements, an error message ‘list is too long’ should be displayed."

Now, there is no reference to this "n" anywhere else, so for me it can only be another parameter. That is, the form will be something like:

find_min_and_max(L, Min, Max, N)

with L being the list, Min the minimum, Max the maximum, and N the value for "n".

This extra parameter just doesn't feel right to me. It seems a clumsy, contrived addition just to have a value for "n".

So, I feel there must be something missing here, something that makes the value of "n" more meaningful.

Any thoughts on this? I'm going with this for now, but I would really like to change it, if somebody could come up with a better idea. Thanks for your time. smiling smiley





Anonymous User
Re: Assignment 1 - Question 4
March 24, 2006 10:40AM
ignore n winking smiley Its a typing mistake winking smiley
Re: Assignment 1 - Question 4
March 28, 2006 08:59PM
Hello there,

How about treating N as a constant and just assign it some reasonable value to limit the maximum number of elements that may be in the list?

It's perhaps still a bit artificial but it doesn't make sense for the CALLER of the procedure to supply the maximum (?)

Regards,
Julian.
Sorry, only registered users may post in this forum.

Click here to login