Message-ID: <37FBC13F.A81E46E9@pentek.com> Date: Wed, 06 Oct 1999 17:38:07 -0400 From: "Charles Krug Jr." X-Mailer: Mozilla 4.61 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: How do I allocate more memory for .exe? References: <37FBA7A1 DOT B7FAEBD6 AT cc DOT umanitoba DOT ca> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: mail.pentek.com X-Trace: 6 Oct 1999 17:41:17 -0400, mail.pentek.com Lines: 35 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com umaveci0 wrote: > > I have an assignment in which I must write a program which solves a > letter 'Jumble'. User types in some letters (rivfey, for example), all > permutations (different combinations) of the letters are put into a > vector ( vector ) and each permutation is compared to another > vector of strings containing about 20,000 words (a dictionary) to get > the answer (verify). Problem is I run out of memory. Both > vector 's are big and solving a 6 letter Jumble causes the > program to crash (5 is okay). I am referencing the vectors. How do I > allow the program to use more memory? > > I'm using DJGPP in WIN95 and have 64Mb of RAM. > > Thanks. Hmmm . . . Why not rewrite your program to use less memory? You don't seem to have any trouble generating your vector of permutations. That's actually kind of tricky, getting all the loops right. But remember that the size of this vector will get HUGE very quickly -- it increases as n! the number of letters. So rather than storing the entire vector of permutations, why not just store each one in turn? This will require a single string instead of a vector with n! elements. If you don't get a match, you generate your next permutation. If the assignment is worded such that you must use a vector for your permutations, as opposed to just the dictionary, then decide in advance how large you will allow your vector to grow. Then divide your vector of permutations accordingly. Charles