Re: Removing White Space...
From: Bob O`Bob (filterbob_at_yahoogroups.com)
Date: 04/10/04
- Next message: Bob O`Bob: "Re: "Invalid Property Value""
- Previous message: MikeB: "Re: Sorting a Text File"
- In reply to: Larry Serflaten: "Re: Removing White Space..."
- Next in thread: Larry Serflaten: "Re: Removing White Space..."
- Reply: Larry Serflaten: "Re: Removing White Space..."
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 10 Apr 2004 08:35:41 -0700
Larry Serflaten wrote:
>
> "Tony Proctor" <tony_proctor@aimtechnology_NOSPAM.com> wrote
> > There are a few variations of the sequence quoted in this thread, e.g.
> >
> > 2, 2, 5, 5, 16, 120
> > 2, 3, 4, 7, 22, 232, 26797
> > 2, 3, 3, 5, 13, 121, 9841, 64570081
> >
> > ..so which is the correct one folks?
>
> The last two I recognise, but I don't remember seeing that top one.
> Perhaps you copied it wrong? In any case, #2 is the best one over all.
> I compared it with the bottom one about the time #2 was posted. For
> about the first 3 terms they were equally performant but after that #2
> was consistantly able to reach higher values than #3.
>
> If you compare them term for term, for the task they were intended,
> you will note that #2's terms are larger from position 3 on. (4 vs 3)
> That means Replace will be replacing larger strings, and as a result,
> do it fewer times for the same level of reduction.
Actually, it doesn't work that way all the time.
I evolved a complex notation a couple of years ago because many times
it just _does not matter_ which of several options are chosen.
(2, 2|3, 3|4, 6|7, 21|22, 231|232) is what I came up with back then,
and none of those substitutions make a difference to where the first
failure occurs:
2,2,3,6,21 first fails at 461, while 2,3,4,7,22 first fails at ... 461.
Insert 231 _or_ 232, and the first failure is at 53591.
I haven't validated it yet (my test program is too slow) but the next
number on my candidate list is 26796. It seems quite likely that 26797
works the same, or slightly better. If my tester didn't take hours,
I'd start with 26795 (53591/2 rounded down) test and increment, until
the failure points start to go back down.
The sequence with 13 in it may or may not be from one of my old attempts,
but either way it's not as good. The one with 16 could easily be from a
post of mine, but again it turned out not as good. 2,2,5,5,16 is pretty
easy to remember, though :-)
Bob
- Next message: Bob O`Bob: "Re: "Invalid Property Value""
- Previous message: MikeB: "Re: Sorting a Text File"
- In reply to: Larry Serflaten: "Re: Removing White Space..."
- Next in thread: Larry Serflaten: "Re: Removing White Space..."
- Reply: Larry Serflaten: "Re: Removing White Space..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|