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,ad0779dc60e28dee X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-10 11:26:54 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Data Structure Choice for DOM Date: 10 Mar 2003 14:10:31 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1047324267 27276 128.183.235.92 (10 Mar 2003 19:24:27 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 10 Mar 2003 19:24:27 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:35147 Date: 2003-03-10T19:24:27+00:00 List-Id: "chris.danx" writes: > Simon Wright wrote: > > Do it the way that gets you working code quickest, profile it (speed > > and memory), and choose another implementation for this part if it's > > justified. > > :) "Premature optimisation is the root of all evil" or something like that? > > Linked list is easiest & quickest. It'll be O(n) in worst case but > it'll work. Later I'll change it to an AVL tree or something else. Be sure to use a good library of data structures, like Booch, Charles, or SAL. They have consistent interfaces to similar data structures, so changing from a linked list to an AVL tree is not hard. In addition, they make it no harder to use an AVL tree instead of a linked list in the first place, since the hard part is already done. Write the requirements for the code, including the time behavior (is O(n) really ok?). That makes it easy to pick from the available, implemented and tested data structures. -- -- Stephe