To [EMAIL PROTECTED]:
I did not actually try the problem under Java, but relied on the report
given by my students. The truth is, until you mentioned it, I did not know
that runtime heap can be increased via command line options like,
java -Xms512m -Xmx512m MyApplication
Thanks for pointing this out.
PMana
***
Quoting Jeffrey Jongko <[EMAIL PROTECTED]>:
> Odd ... you mean doing something like this won't work in Linux? (
> random.txt contains 1000000 16-digit numeric values) Or was it an out
> of memory problem? If its the latter (which I got when I ran this the
> first time) I just upped the allocated java heap size and it proceeded.
>
> public static void main(String[] args) throws Exception
> {
> String[] nums = new String[1000000];
>
> FileReader fr = new FileReader("random.txt");
> BufferedReader br = new BufferedReader(fr);
>
> String currentLine;
> int counter = 0;
>
> while ( (currentLine=br.readLine()) != null)
> {
> nums[counter] = currentLine;
> counter++;
> }
> }
JM Ibanez <[EMAIL PROTECTED]> wrote: Pablo Manalastas
writes:
> For my CS135 class at U.P., I gave a programming
> assignment to compare the performance of quicksort,
> heapsort, mergesort, and radixsort, on arrays of
> strings. Each string is of fixed size 16 characters,
> and the sort must be done on arrays of sizes 100000,
> 200000, 300000, ... , 900000, 1000000. The students
> are free to choose the operating system, and the
> programming language. I showed the class that the
> programming assignment can be done with Debian on 1GB
> ram, using Gnu C, by giving the class a demo of
> quicksort of the array of one million 16-character
> strings.
>
> Among the problems that my students encountered and
> reported to me are the following:
>
> 1. You can not do the programming assignment on
> Windows, since the Windows development environment can
> not support such big arrays.
>
> 2. You can not do the programming assignment using
> Java on Linux, since Java-for-Linux does not support
> such big arrays.
Not raw arrays as such, but what prevents you from using, say, an
java.util.ArrayList? Or a java.util.Vector?
Or, in fact, encapsulate the whole data structure operated on into a
class and pass the sort method as a functor?
> So the students are forced to use Linux, using C, C++
> or any tool that allows management of large arrays.
> Unconsciously, I gave a programming assignment that
> promoted the use of Linux, and extolled the virtues of
> Linux, without making the advertisement so obvious.
Sure, but again, I could probably do it in Java on any platform.
I'm in fact tempted to write a quick one-off to demonstrate... :P
(Caveat: I'm a programmer doing lots of Java, with a love-hate
relationship with the language. My primary development environment is
JDEE on Emacs on a Linux system.)
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph