home bbs files messages ]

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

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

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

   Message 2,807 of 2,978   
   Dr J R Stockton to All   
   Re: Optimization problem   
   18 May 10 18:13:08   
   
   From: reply1020@merlyn.demon.co.uk   
      
   In comp.lang.pascal.borland message <85akp6F4bpU1@mid.individual.net>,   
   Sun, 16 May 2010 18:28:26, Robert AH Prins  posted:   
      
   (to clpb only)   
      
   >The program processes an array of N cells, with N up to about 4096. The   
   >array is filled from the start, it may not be completely full but there   
   >are no empty cells between full cells. A cell contains a value of   
   >1..255, so logically every cell would be a byte, but if processing   
   >efficiency requires each cell to be a word or even a double-word, that   
   >would be no problem. The values are normalized, they are effectively   
   >indexes into a table, so if the table contains just T entries, the   
   >values would go from 1 to T.   
   >   
   >Given the above setup, the problem is to find *all* sub-arrays that   
   >contain 3..T distinct elements and are as short as possible, i.e. if   
   >there are 42 sub-arrays of three elements containing three distinct   
   >values, there is no need to find sub-arrays of four elements containing   
   >three distinct values. Also, a shorter sub-array may *never* be a part   
   >of a longer sub-array containing *only* distinct values.   
      
   I can generate a circular list of 532 items of values 0 to 34 (or 22 to   
   56), to which such an algorithm might be applied.  A related list has   
   5.700,000 items of the same values.  There is a constraint which means   
   that the gaps between consecutive instances of any value can only be of   
   certain sizes.   
      
   --   
    (c) John Stockton, nr London UK.  ?@merlyn.demon.co.uk  Turnpike v6.05  MIME.   
      TP/BP/Delphi/&c., FAQqy topics & links;   
        RAH Prins : c.l.p.b mFAQ;   
      Timo Salmi's Turbo Pascal FAQ.   
      
   --- 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