home bbs files messages ]

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

   comp.programming      Programming issues that transcend langua      57,431 messages   

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

   Message 56,678 of 57,431   
   Tim Rentsch to Dmitry A. Kazakov   
   Re: A little puzzle.   
   25 Nov 22 01:16:19   
   
   From: tr.17687@z991.linuxsc.com   
      
   "Dmitry A. Kazakov"  writes:   
      
   > On 2022-11-24 23:51, Tim Rentsch wrote:   
   >   
   >> For the general case we would like to handle any circular measure   
   >> (for convenience having coordinates in some integer range).   
   >[...]   
   >> Exercise: write a function to answer this kind of question for   
   >> circular measures in general.  You may assume integer coordinates   
   >> and intervals that include the starting point but do not include   
   >> the end point.  Give a suitable declaration for the function,   
   >> and separately give a function definition to implement the given   
   >> interface.   
   >   
   > Usual technique is expanding the range this or that way.  E.g.   
   >   
   > - Computing differences in the specified direction and complementing   
   > by the modulo when the difference turns negative.   
   > - Using large non-modular numbers that never overflow, e.g. with   
   > indices of a ring buffer.  A 64-bit sequence number I is the new   
   > "index."  To access elements I mod N is used.   
      
   Even Edsgar Dijkstra wrote code to show solutions to   
   programming exercises.  Where is your code?   
      
   --- 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