> -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 ,
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
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
--- "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
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
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
--- 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
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
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
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
> 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
= \@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
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
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
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
--- 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
--- 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
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?:
> 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
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
#
> -----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
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
--- [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
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
[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
--- [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
"\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
> > 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
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&
> 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
> }
> @
> 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
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
> 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
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 ?
>
>
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
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
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
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
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
>
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
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
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
42 matches
Mail list logo