home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:12260 comp.programming:2293
- Newsgroups: comp.lang.c,comp.programming
- Path: sparky!uunet!mcsun!sun4nl!alchemy!matthys
- From: matthys@cs.ruu.nl (Matthys Kuiper)
- Subject: Re: A LITTLE BRAINTEASER...
- Message-ID: <1992Aug13.072329.27685@cs.ruu.nl>
- Date: Thu, 13 Aug 1992 07:23:29 GMT
- References: <aet.713608023@munagin> <1992Aug12.103013.4999@cs.ruu.nl> <17063@ulysses.att.com>
- Organization: Utrecht University, Dept. of Computer Science
- Lines: 25
-
- In <17063@ulysses.att.com> kpv@ulysses.att.com (Phong Vo) writes:
-
- >In article <1992Aug12.103013.4999@cs.ruu.nl> matthys@cs.ruu.nl (Matthys Kuiper) writes:
- >>In <aet.713608023@munagin> aet@mullian.ee.mu.OZ.AU (bert thompson) writes:
- >>>is it possible to write a program that reverse the order of input lines
- >>>without using data structures.
- >>>the rules of the game are you can use anything but data structures, or more
- >>>specifically you cannot use the heap.
- >>
- >>Below is my solution in Pascal. The translation of this program
- >>into C is horrible to read and not included in this posting.
- ><code deleted>
- >
- >The code probably isn't right either since functions such as readln() may very well
- >does some form of dynamic memory allocation to store the lines.
- No, readln(input) just skips till the end of a line; it does not have to store any
- of the skipped characters.
- To solve the problem you must assume something
- about the heap usage of basic I/O routines. I assume that reading and/or skipping
- basic characters does not use the heap.
-
- --
- Matthijs F. Kuiper Department of Computer Science
- kuiper@cs.ruu.nl Padualaan 14/ Postbox 80.089
- 3508 TB Utrecht/ The Netherlands
-