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,793 of 57,431    |
|    Tim Rentsch to Stefan Ram    |
|    Re: Another little puzzle    |
|    21 Dec 22 13:17:55    |
      From: tr.17687@z991.linuxsc.com              ram@zedat.fu-berlin.de (Stefan Ram) writes:              > ram@zedat.fu-berlin.de (Stefan Ram) writes:       >       >> Given n times of the 24-hour day, print their average.       >> For example, the average of "eight o'clock" and       >> "ten o'clock" (n=2) would be "nine o'clock".       >> (You can choose any representation, for example "HH:MM"       >> or "seconds since midnight".)       >       > Thanks for all replies!       >       > I waited a few days before answering to allow       > sufficient time to think about the problem.       >       > There were not enough tests written and run. As a result,       > the puzzle has not yet been solved (unless I have overlooked       > a contribution or misworded expectations).       >       > So, here are two possible test cases.       >       > average( 23.5, 1.5 )== 0.5       > average( 11.5, 13.5 )== 12.5       >       > (I use hours as units, so "0.5" means, "half past midnight".)       >       > I hope that these test cases encode sensible expectations       > for an average of two times on a 24-hour clock in the spirit       > of the example given in the OP, which was, "the average of       > eight o'clock and ten o'clock would be nine o'clock", since       > these test cases just have rotated that example by 3.5 and       > 15.5 hours.       >       > I believe that I have not seen an algorithm so far in this       > thread that would pass these tests.              As before, the problem is underspecified.              What is average( 0700, 1900 ), where the times indicate 24-hour       military times?              What is average( 1900, 0700 )?              What is average( 0100, 0700, 1300, 1900 )?       What is average( 0700, 1300, 1900, 0100 )?       What is average( 1300, 1900, 0100, 0700 )?       What is average( 1900, 0100, 0700, 1300 )?              and similarly for all other permutations of       the four arguments?              Stop giving just examples; instead give a statement       of the problem that gives correct answers for all       inputs. Giving just examples is a waste of everyone's       time.              --- 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