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,680 of 57,431   
   Dmitry A. Kazakov to Tim Rentsch   
   Re: A little puzzle.   
   25 Nov 22 11:11:05   
   
   From: mailbox@dmitry-kazakov.de   
      
   On 2022-11-25 10:16, Tim Rentsch wrote:   
   > "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?   
      
   If you ask for code rather than for an algorithm, you must formalize you   
   question, by providing written specifications in the programming   
   language of choice. E.g. specify the ADT longtitude and the operations   
   you want to implement on it, e.g. range comparisons.   
      
   --   
   Regards,   
   Dmitry A. Kazakov   
   http://www.dmitry-kazakov.de   
      
   --- 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