From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71c743c03ed191fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-21 15:23:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn4feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc52.ops.asp.att.net.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Beginer problem: variable array size References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc52.ops.asp.att.net 1032647005 12.234.13.56 (Sat, 21 Sep 2002 22:23:25 GMT) NNTP-Posting-Date: Sat, 21 Sep 2002 22:23:25 GMT Organization: AT&T Broadband Date: Sat, 21 Sep 2002 22:23:28 GMT Xref: archiver1.google.com comp.lang.ada:29241 Date: 2002-09-21T22:23:28+00:00 List-Id: >The reality is that by putting a requirement out there that there must be no >limit on the number of elements accepted, you create a difficulty that >doesn't normally exist in the real world. I'd rephrase that as "you fudge away a difficulty that does exist in the real world". Obviously no program on a real computer will accept a truly unlimited amount of input, and certainly not in a finite length of time. It's just that by not explicitly dimensioning an array you make it seem as if the input is umlimited. If you use, for instance, a quadratic sort, you're probably in fact limited to a few thousand elements before things get totally unreasonable. Given that input is coming from a user, according to the problem statement, you might have 8*3600= 28800 values if someone input one/second for 8 hours, so using List : array(1 .. 8*3600) of Integer; and a better than quadratic sort is probably much simpler and more reasonable than a (pretend) "no limit". I think the prof's problem statement should have ended with "Document and justify any assumptions you had to make because of missing details in the problem statement." If the intent is to teach about linked lists and dynamic arrays, a more realistic, and thus more convincing, problem with multiple collections of various sizes, but a certain maximum sum of sizes, would be better.