The T-Files


Fri, 19 Aug 2005

Takahashi-san's Birthday Darts

First game (8 sets count-up):

    2   13  T-18 T-15  T-20 T-20 OUT   13
    2    1     2   10     6  T-1  13 T-15
   10    2     2  OUT     1    3   1    1
=========================================
   14   30    88  143   210  276 290  349

Second game (8 sets count-up):

    5    6    18    3  T-18   20  17    4
   13 T-20   OUT   17    18 T-10  20    4  
    1  OUT    11    1  D-18    4  18 D-20 
=========================================
   19   85   114  135   243  297 352  400

Third game (counting down from 301):

   14    3   15    13    4  T-17 OUT  OUT   4
  T-1   20    2    15   13     9  19    7 OUT   
 BULL   15    1      7   3     5 OUT BULL   3 
=============================================
  234       196  178 143  123  58 39 BUST  32


Fourth game (counting down from 301):

    3  OUT  OUT     6 BULL    5   10  
    7   20   11     7    2    5    2     
    3    2   19    10 T-19   12    7   
======================================
  288  266  236   213 104    82   63                          


Sort with stop key? Anyone?

I wonder if I can just post tricky questions on my blog and expect answers. Probably not. Anyways, this one is for the algorithm gurus (I cannot even remember how quick sort works anymore, and my Knuth Bible is about eight timezones away right now):

I want to sort a rather largish amount m of items, but because I only need to first n items, I would like to terminate the algorithm once these n items have been found and not bother to sort the whole rest (because n << m).

That would be Step One. Step Two would be an algorithm that can be put in streaming mode, so that I can iterate over the items in order, without knowing how many I need in advance (because the items will go through a filter that discards some of them. Running the filter before the sort is not an option, as the filter is very heavy and should only be invoked for n' << m items).

Thanks.