An interesting problem
McGlinchy, Alistair
Alistair.McGlinchy at marks-and-spencer.com
Wed Jan 3 20:10:48 GMT 2007
03 January 2007 19:33 Andy Armstrong:
> On 3 Jan 2007, at 14:03, Paul Orrock wrote:
> > Does anyone have any clever ways of doing this other than brute
> > forcing it by checking every possible range (in a 100 by 30
> table).
> > And if brute forcing it is the only option (which I suspect it is)
> > does anyone have any clever ways of doing it. Using numbers for
> > columns and rows instead of letters is fine.
>
> If you do end up brute forcing it you may be able to speed it up by
> first computing a quad tree. To do that you'd calculate the sum of
> each 2x2 meta-square and then do that recursively until you end up
> with a single square that's the sum of all the squares like this:
>
That's sort of what I have been playing with, but it still doesn't seem
impressively fast. There's a large number of off-by-one errors possible
in here, but the answers seems to tally up when I check in Excel.
I'd be interested in comments:
Cheers
Alistair
**********************************************************************
Registered Office:
Marks and Spencer plc
Waterside House
35 North Wharf Road
London
W2 1NW
Registered No. 214436 in England and Wales.
Telephone (020) 7935 4422
Facsimile (020) 7487 2670
<<www.marksandspencer.com>>
Please note that electronic mail may be monitored.
This e-mail is confidential. If you received it by mistake, please let us know and then delete it from your system; you should not copy, disclose, or distribute its contents to anyone nor act in reliance on this e-mail, as this is prohibited and may be unlawful.
2005
More information about the london.pm
mailing list