RE: union of times algorithm

2002-06-06 Thread Jackson, Harry
> -Original Message- > From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] > > > --- "Jackson, Harry" <[EMAIL PROTECTED]> wrote: > > > I have been looking back at this problem and here is what I > have found. > > > > Lets take the following set of times > > A , B > > 1 (4 ,

Re: union of times algorithm

2002-06-05 Thread Bryan R Harris
It was inferred from my original post that the start/stop times were all integers, which actually was not true. That's why the bitmap union idea sounds good, but doesn't work with non-integers. Thanks to some ideas I got from several people on the list, however, I came up with an algorithm that

Re: union of times algorithm

2002-06-05 Thread Jenda Krynicky
From: "Bryan R Harris" <[EMAIL PROTECTED]> > I'm trying to come up with an algorithm that seems like it ought to be > really easy, but it's turning out to be pretty tough... > > Basically I have three pairs of start/stop times, e.g.: > >3, 5 >4, 10 > 15, 20 > > I want the total time c

RE: union of times algorithm

2002-06-05 Thread Jonathan E. Paton
--- "Jackson, Harry" <[EMAIL PROTECTED]> wrote: > > I have been looking back at this problem and here is what I have found. > > Lets take the following set of times >A , B > 1 (4 , 5) > 2 (9 , 10) > 3 (11 , 12) > 4 (12 , 14) > 5 (12 , 18) > 6 (14 , 15) > > If

RE: union of times algorithm

2002-06-05 Thread Jackson, Harry
Hi I have been looking back at this problem and here is what I have found. Lets take the following set of times A , B 1 (4 , 5) 2 (9 , 10) 3 (11 , 12) 4 (12 , 14) 5 (12 , 18) 6 (14 , 15) If we sort by column A the set inherits the following prope

Re: union of times algorithm

2002-05-31 Thread David T-G
Bryan, et al -- ...and then Bryan R Harris said... % % Nope, the compiler won't allow that... Does it work for you? % % It gives the errors: % Scalar value @lines[0] better written as $lines[0] at ... % Can't use subscript on array slice at ... near "1]" % Execution ... aborted due to c

RE: union of times algorithm

2002-05-31 Thread Ovid
--- Bryan R Harris <[EMAIL PROTECTED]> wrote: > > Thanks Ovid, Timothy... > > You mention checking out perlref in the perldocs-- I'm familiar with > "perldoc -f keyword", but how would I find information on these things if I > didn't know the keyword "perlref"? (Apparently I'm the only legitima

RE: union of times algorithm

2002-05-31 Thread Timothy Johnson
1, 2002 3:15 PM To: [EMAIL PROTECTED] Subject: RE: union of times algorithm Thanks Ovid, Timothy... You mention checking out perlref in the perldocs-- I'm familiar with "perldoc -f keyword", but how would I find information on these things if I didn't know the keyword "p

RE: union of times algorithm

2002-05-31 Thread Bryan R Harris
Ovid, Jonathan, Thank you so much, I think my understanding of Perl went up a whopping 50% today (incidentally placing me somewhere in the bottom 3% of the list readers, I fear). I can feel my addiction growing daily... Thanks again. - B __ > You mention checking out perlre

RE: union of times algorithm

2002-05-31 Thread Bryan R Harris
riginal Message- From: Bryan R Harris [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 3:26 PM To: [EMAIL PROTECTED] Subject: RE: union of times algorithm Nope, the compiler won't allow that... Does it work for you? It gives the errors: Scalar value @lines[0] better written as $lin

RE: union of times algorithm

2002-05-31 Thread Jonathan E. Paton
> You mention checking out perlref in the perldocs - I'm familiar > with "perldoc -f keyword", but how would I find information on > these things if I didn't know the keyword "perlref"? I can't find any email answering this question: perldoc perl OR perldoc perltoc isn't it so

RE: union of times algorithm

2002-05-31 Thread Bryan R Harris
= \@somearray; Makes $somevar into a reference to the array @somearray. you see this format often when passing a reference to an array to a subroutine or function. -Original Message- From: Bryan R Harris [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 2:19 PM To: [EMAIL PROTECTE

RE: union of times algorithm

2002-05-31 Thread Timothy Johnson
PROTECTED] Subject: RE: union of times algorithm Thanks Ovid, Timothy... You mention checking out perlref in the perldocs-- I'm familiar with "perldoc -f keyword", but how would I find information on these things if I didn't know the keyword "perlref"? (Apparently

RE: union of times algorithm

2002-05-31 Thread Bryan R Harris
to a reference to the array @somearray. you see this format often when passing a reference to an array to a subroutine or function. -Original Message- From: Bryan R Harris [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 2:19 PM To: [EMAIL PROTECTED] Subject: RE: union of times algor

RE: union of times algorithm

2002-05-31 Thread Timothy Johnson
ROTECTED] Subject: RE: union of times algorithm Wow, you guys are amazing... This most recent seems to work, so I'm set (though I still don't quite understand it). A few quick questions: 1. What does this do?: $somevar = [ @somearray, $somescalar ]; 2. and th

RE: union of times algorithm

2002-05-31 Thread Ovid
--- Ovid <[EMAIL PROTECTED]> wrote: > > 3. and this?: $somevar = \@somearray; > > Putting a backslash in front a a sigil creates a returns a reference to it... That was coherent. :) I have come to the conclusion that I will be a better programmer if I can only learn to type. That fi

RE: union of times algorithm

2002-05-31 Thread Ovid
--- Bryan R Harris <[EMAIL PROTECTED]> wrote: > > Wow, you guys are amazing... This most recent seems to work, so I'm set > (though I still don't quite understand it). > > A few quick questions: > > 1. What does this do?: $somevar = [ @somearray, $somescalar ]; The construct "@somea

RE: union of times algorithm

2002-05-31 Thread Bryan R Harris
Wow, you guys are amazing... This most recent seems to work, so I'm set (though I still don't quite understand it). A few quick questions: 1. What does this do?: $somevar = [ @somearray, $somescalar ]; 2. and this?: $somevar = $someothervar->[$athirdvar]; 3. and this?:

RE: union of times algorithm

2002-05-31 Thread Jonathan E. Paton
> Okay, I've repaired it - it now works fine under warnings and strict. > Almost all my code is written for strictures, I just posted my code > in an intermediate form without having debugged it. I think it still > isn't working right, as the answer given is 6 but I reckon it should > be 7! Hi g

RE: union of times algorithm

2002-05-31 Thread Shishir K. Singh
int $_, " ", $hash{$_}, "\n"; } -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 2:18 PM To: [EMAIL PROTECTED] Subject: RE: union of times algorithm --- "Shishir K. Singh" <[EMAIL PROTECTED]> wrote: > Is the

RE: union of times algorithm

2002-05-31 Thread Jonathan E. Paton
# > -----Original Message- > From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] > Sent: Friday, May 31, 2002 1:58 PM > To: [EMAIL PROTECTED] > Subject: RE: union of times algorithm > > > --- [EMAIL PROTECTED] wrote: > > What we have is as stated a uni

RE: union of times algorithm

2002-05-31 Thread Shishir K. Singh
Sent: Friday, May 31, 2002 2:10 PM To: [EMAIL PROTECTED] Subject: RE: union of times algorithm --- [EMAIL PROTECTED] wrote: > No. you have 11,12 as 2 when only 1. Right? > > Wags ;) Oops, yeah. I guess I made it easy for you to spot, could do something about the complexity, couldn&#x

RE: union of times algorithm

2002-05-31 Thread Jonathan E. Paton
--- [EMAIL PROTECTED] wrote: > No. you have 11,12 as 2 when only 1. Right? > > Wags ;) Oops, yeah. I guess I made it easy for you to spot, could do something about the complexity, couldn't you? O(length of total timeframe) isn't exactly hot. I'm looking at Shishir K. Singh's algorithm

RE: union of times algorithm

2002-05-31 Thread Wagner-David
No. you have 11,12 as 2 when only 1. Right? Wags ;) -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 10:58 To: [EMAIL PROTECTED] Subject: RE: union of times algorithm --- [EMAIL PROTECTED] wrote: > What we have is

RE: union of times algorithm

2002-05-31 Thread Shishir K. Singh
[mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 1:58 PM To: [EMAIL PROTECTED] Subject: RE: union of times algorithm --- [EMAIL PROTECTED] wrote: > What we have is as stated a union of times. So all I do is take the > timeslices and generate a hash element for each time. I don't

RE: union of times algorithm

2002-05-31 Thread Jonathan E. Paton
--- [EMAIL PROTECTED] wrote: > What we have is as stated a union of times. So all I do is take the > timeslices and generate a hash element for each time. I don't check to see > if it is already there, but just set to one. Then I sort the hash down > numerically and total where current minu

RE: union of times algorithm

2002-05-31 Thread Wagner-David
"\n"; printf "Total: %4d\n", $MyTotal; Output: 2 3 4 5 6 7 8 9 11 12 14 17 18 19 Total: 10 Wags ;) -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 01:08 To: [EMAIL PROTECTED] Subject: RE: union of time

RE: union of times algorithm

2002-05-31 Thread Jonathan E. Paton
> > I'm trying to come up with an algorithm that seems like it ought to be > > really easy, but it's turning out to be pretty tough... > > > > Basically I have three pairs of start/stop times, e.g.: > > > >3, 5 > >4, 10 > > 15, 20 > > > > I want the total time covered by all these ran

RE: union of times algorithm

2002-05-30 Thread Wagner-David
keyword. Wags ;) -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 14:08 To: [EMAIL PROTECTED] Subject: Re: union of times algorithm > I'm trying to come up with an algorithm that seems like it ought to be > really easy, but it&

Re: union of times algorithm

2002-05-30 Thread Jonathan E. Paton
> my @sorted = map { $_->[0] } ^^^ delete this... might help > sort { $a->[0] <=> $b->[0] # Sort by element 0 > || > $b->[1] <=> $b->[1] # then by element 1 > } > @

Re: union of times algorithm

2002-05-30 Thread Jonathan E. Paton
> I'm trying to come up with an algorithm that seems like it ought to be > really easy, but it's turning out to be pretty tough... > > Basically I have three pairs of start/stop times, e.g.: > >3, 5 >4, 10 > 15, 20 > > I want the total time covered by all these ranges. I can't just s

RE: union of times algorithm

2002-05-30 Thread Shishir K. Singh
id Gray [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 11:53 AM To: [EMAIL PROTECTED] Cc: 'Bryan R Harris'; 'Janek Schleicher'; 'Felix Geerinckx' Subject: RE: union of times algorithm > I'm trying to come up with an algorithm that seems like

RE: union of times algorithm

2002-05-30 Thread David Gray
> I'm trying to come up with an algorithm that seems like it > ought to be really easy, but it's turning out to be pretty tough... > > Basically I have three pairs of start/stop times, e.g.: > >3, 5 >4, 10 > 15, 20 > > I want the total time covered by all these ranges. I can't > ju

Re: union of times algorithm

2002-05-30 Thread Janek Schleicher
Felix Geerinckx wrote at Thu, 30 May 2002 14:41:45 +0200: > on Thu, 30 May 2002 13:06:04 GMT, [EMAIL PROTECTED] (Janek Schleicher) wrote: > >> Sorry, but 3 to 10 are 3,4,5,6,7,8,9,10 = 8 times >> and 15 to 20 are 15,16,17,18,19,20 = 6 times. >> So the answer should be 8+6 = 14, shouldn't ? > >

Re: Re: union of times algorithm

2002-05-30 Thread Felix Geerinckx
on Thu, 30 May 2002 13:34:32 GMT, [EMAIL PROTECTED] (Lonewolf) wrote: > Shouldn't the answer be 12? Yes, that's also what I think (and what both Beau's and my solution returned as the answer). -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

Re: Re: union of times algorithm

2002-05-30 Thread LoneWolf
Shouldn't the answer be 12? >On 30 May 2002 12:41:45 - Felix Geerinckx <[EMAIL PROTECTED]> wrote. >on Thu, 30 May 2002 13:06:04 GMT, [EMAIL PROTECTED] (Janek >Schleicher) wrote: > >> Sorry, but 3 to 10 are 3,4,5,6,7,8,9,10 = 8 times >> and 15 to 20 are 15,16,17,18,19,20 = 6 times. >> So the

Re: union of times algorithm

2002-05-30 Thread Felix Geerinckx
on Thu, 30 May 2002 13:06:04 GMT, [EMAIL PROTECTED] (Janek Schleicher) wrote: > Sorry, but 3 to 10 are 3,4,5,6,7,8,9,10 = 8 times > and 15 to 20 are 15,16,17,18,19,20 = 6 times. > So the answer should be 8+6 = 14, shouldn't ? I don't think so: "Lunch from 1 to 2 pm" means one hour lunch, not t

Re: union of times algorithm

2002-05-30 Thread Janek Schleicher
Bryan R Harris wrote at Thu, 30 May 2002 01:58:19 +0200: > I'm trying to come up with an algorithm that seems like it ought to be really easy, >but it's > turning out to be pretty tough... > > Basically I have three pairs of start/stop times, e.g.: > >3, 5 >4, 10 > 15, 20 > > I wan

Re: union of times algorithm

2002-05-30 Thread Felix Geerinckx
on Wed, 29 May 2002 23:58:19 GMT, [EMAIL PROTECTED] (Bryan R Harris) wrote: > > I'm trying to come up with an algorithm that seems like it ought > to be really easy, but it's turning out to be pretty tough... > > Basically I have three pairs of start/stop times, e.g.: > >3, 5 >4, 10 >

RE: union of times algorithm

2002-05-29 Thread Beau E. Cox
nesday, May 29, 2002 1:58 PM To: [EMAIL PROTECTED] Subject: union of times algorithm I'm trying to come up with an algorithm that seems like it ought to be really easy, but it's turning out to be pretty tough... Basically I have three pairs of start/stop times, e.g.: 3, 5 4, 10

RE: union of times algorithm

2002-05-29 Thread Beau E. Cox
me. Aloha => Beau. PS: Anyone have a solution with some elegance? -Original Message- From: Bryan R Harris [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 1:58 PM To: [EMAIL PROTECTED] Subject: union of times algorithm I'm trying to come up with an algorithm that seems

union of times algorithm

2002-05-29 Thread Bryan R Harris
I'm trying to come up with an algorithm that seems like it ought to be really easy, but it's turning out to be pretty tough... Basically I have three pairs of start/stop times, e.g.: 3, 5 4, 10 15, 20 I want the total time covered by all these ranges. I can't just say (5-3 + 10-4 + 20