Re: n00b input help



moostafa wrote:

I'm writing a program that performs arithmetic operations on
integers. I want to be able to type in a bunch of integers
seperated by any amount of white space then terminate input with
a non-integer character. I plan to put my input into an array,
and while I have a max size I don't have a min and don't know
exactly how many arguments to expect.
I would really appreciate any ideas.

The usual solution for input of unknown length is a linked list.
Once you have determined the total input you can then use it as is,
sort it, convert it into an array, or what-not. Linked lists are
best sorted with mergesort.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>


.



Relevant Pages

  • Re: References as Hash Keys, Tree Structures (Newbie) (Was: simple pointer operations (newbe))
    ... hashed but the hash code returned by that object is used as the index. ... They say quite compactly that a hash is an array of pointers to linked lists ... Which reminds me what's the origin of the term bucket when talking about ...
    (comp.lang.perl.misc)
  • Re: My thoughts on Time/Speed
    ... As I was considering different amounts of exertion, ... One of my rewrites used a priority queue for the schedule. ... My current schedule structure is an array of pointers, ... the timing system to keep the linked lists quite short. ...
    (rec.games.roguelike.development)
  • Re: garbage collection problem in large linked lists
    ... Instead all buckets are allocated at once in an array. ... VG.net, which must be very scalable, but only for lists which would normally ... Linked lists require pointer dereferencing in order to traverse. ... When you run out of space, you allocate a new smaller array. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Creating an array of objects (newbie question)
    ... in the array with the cell of the array pointing to the head of each ... You'll basically work with an array of linked lists. ... error for another reason (like trying to reference a non-static member ... If my linked list object had a head and node, ...
    (comp.lang.java.programmer)
  • Creating an array of objects (newbie question)
    ... I'm trying to create an array of size N with objects that will be ... requirement is to be able to create linked lists in a bucket in the ... Confusion couldn't be finer right now. ... I mean, is Java capable? ...
    (comp.lang.java.programmer)