home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,905 of 33,346   
   =?ISO-8859-1?Q?=D6=F6_Tiib?= to Francis Glassborow   
   Re: insert [sorted] a node in a linked l   
   10 Mar 13 15:39:20   
   
   From: ootiib@hot.ee   
      
   On Sunday, 10 March 2013 09:47:01 UTC+2, Francis Glassborow  wrote:   
   > On 09/03/2013 14:52, Öö Tiib wrote:   
   > > Linked list is a good container for rather unusual case. Order should   
   > > be important, ordering is based on decisions unpredictable   
   > > compile-time (no sorting algorithm) and inserts and erases happen in   
   > > the middle. I haven't found a need for such thing during 20 years of   
   > > development. Always some other container behaved more efficiently.   
   >   
   > I am struggling to understand what you mean. A linked list is   
   > particularly good where you need to be able to   
   > 1) splice two containers together (particularly if the elements are   
   > expensive to copy)   
   >   
   > 2) when you need to remove elements, or replace an element with several   
   > elements.   
      
   What I meant is that one considers other containers when array is   
   inefficient and that feels. So ... there is performance issue. List   
   does not win the contest of solutions. For splicing and erasing   
   subsequences various cords seem to work best. Tries seem to take over   
   with frequent need to search for patterns ... etc.   
      
   Several container types are not in standard library but performance   
   is usually improved by experienced specialists so that does not matter.   
      
   > The problem is that it is expensive in storage when the elements are small.   
      
   However when the elements are large then they tend to be polymorphic. That   
   results with std::list being again insufficient. Intrusive lists might do.   
      
   > As a matter of interest, what container would you suggest be used for   
   > substantial amounts of text (e.g. a 500 page book)?   
      
   Depends what information it contains and what must be done with it. Often   
   such things contain structured information, often are used immutably etc.   
      
   If it is free-form text and the program has to edit it then rope of   
   characters from STL (not in standard library) might be best for   
   starters. If the text has some inner structure then that results usually   
   with a tree of that structure.   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca