Elementary but surprisingly difficult.
- From: Albert van der Horst <albert@xxxxxxxxxxxxxxxxxx>
- Date: 24 May 2008 20:05:48 GMT
During the Euler stuff I came upon this following sub-problem.
It is elementary enough to be in a library somewhere.
An area giving as (addr_start, addr_end) contains items
of length ``len''. I want to get of the duplicates.
Sorting the items is pretty easy, qsort can handle that.
Now eliminating the duplicates, we need only compare one
item to the next.
Something along compact (start, end, len -- end' )
The new end should be returned, of course.
Even using variables/locals, I find this difficult.
(More difficult then e.g. making a table for the number of
dividers of N, which sounds much less trivial.)
--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
.
- Follow-Ups:
- Re: Elementary but surprisingly difficult.
- From: Jonah Thomas
- Re: Elementary but surprisingly difficult.
- From: John Passaniti
- Re: Elementary but surprisingly difficult.
- From: mark4
- Re: Elementary but surprisingly difficult.
- From: Slava Pestov
- Re: Elementary but surprisingly difficult.
- Prev by Date: Re: what is the fastest way of finding an integer square root?
- Next by Date: Re: netpipes and gforth
- Previous by thread: EuroForth 2008 registration open, and other information
- Next by thread: Re: Elementary but surprisingly difficult.
- Index(es):