> "PP" == Philip Potter writes:
PP> Actually, there is a certain amount of reasoning possible with respect
PP> to comparison functions: for example, a Schwartzian Transform will be
PP> a win if the key calculation is more expensive than the comparison of
PP> keys.
that is incorrect.
2009/11/9 Michael Alipio :
> Hi,
>>
>> Do you need the fastest possible sort?
>
> I'm not even sure if I really need to worry about all these
> sorting techniques. My program just reads a text file
> (wordlist). It might be megabyte-sized or probably few
> gigabytes (i might also add size checking
On Monday 09 Nov 2009 19:40:29 Uri Guttman wrote:
> > "MA" == Michael Alipio writes:
>
> MA> i'm planning to sort an input file (which was File::Slurp'ed, most
> MA> likely megabyte-sized file) in various ways. I did some readings
> MA> and learned several methods that people have come
Hi,
>
> Do you need the fastest possible sort?
I'm not even sure if I really need to worry about all these
sorting techniques. My program just reads a text file
(wordlist). It might be megabyte-sized or probably few
gigabytes (i might also add size checking on this to be
safe with File::Sl
2009/11/9 Michael Alipio :
> Hi,
>
> i'm planning to sort an input file (which was File::Slurp'ed, most likely
> megabyte-sized file) in various ways. I did some readings and learned several
> methods
> that people have come up with in recent years. So to summarize, the default
> sort is fast (u
> "MA" == Michael Alipio writes:
MA> i'm planning to sort an input file (which was File::Slurp'ed, most
MA> likely megabyte-sized file) in various ways. I did some readings
MA> and learned several methods that people have come up with in
MA> recent years. So to summarize, the default
Hi,
i'm planning to sort an input file (which was File::Slurp'ed, most likely
megabyte-sized file) in various ways. I did some readings and learned several
methods
that people have come up with in recent years. So to summarize, the default
sort is fast (uses quick sort), explicit (using sub) is
Ok, for those interested the threshold for shuffling is 256 elements.
Though I'm still confused on shuffling vs. random quicksort, I imagine
thats a question only the person who implemented it can answer. And
thanks for the clarification on lists vs arrays.
On 12/13/06, John W. Krahn <[EMAIL PRO
Jason Roth wrote:
> I was reading the perldoc for the sort function and I had a few
> questions. http://perldoc.perl.org/sort.html says that large arrays
> will be shuffled to ensure nlgn runtime. What is the cutoff for
> "large arrays" and is there a reason that it isn't simply using a
> randomi
I was reading the perldoc for the sort function and I had a few
questions. http://perldoc.perl.org/sort.html says that large arrays
will be shuffled to ensure nlgn runtime. What is the cutoff for
"large arrays" and is there a reason that it isn't simply using a
randomized quicksort?
Also http:/
thanks
this solved my problem
my @output_sorted = sort { (split /,/, $b)[0] <=> (split /,/, $a)[0] }
@output;
thanks to all that helped
Jeff Pang <[EMAIL PROTECTED]> writes:
>
>>this is my friend's script
>>
>># collect all score
>> my @output = ();
>> my @old_output = ();
>> for
This is not exactly an answer to your question, but hopefully it will be
helpful.
Whenever I have what is for me a non-trivial problem in an application, I
write a script that deals only with what seems to be the error in the
application script. I then fiddle with the former until I solve the
>this is my friend's script
>
># collect all score
> my @output = ();
> my @old_output = ();
> foreach my $list (@bugkillers) {
>my ($id,$name) = split(/,/, $list);
>my $score =
>$Bugs->getSCORE($showold,$id,$contest,$pContest,$groups);
>push(@output,"$score,
am a real newbie to perl
I have a friend who wrote this program which outputs the scores of my
friends
the code works and outputs the correct scores and arrangement of the scores
but im having this error on my http/error_log,
this is the error:
[Thu Mar 23 16:43:28 2006] [error] [client 203
Bob Showalter wrote:
>
> > From: [EMAIL PROTECTED]
> >
> > This should not matter what the size is but would
> > expect a number at
> > the beginning:
> >
> > foreach my $MyKey (sort {$a->[1] <=> $b->[1]}
> > map{[ $_, /^(\d+)/ ]}
> > keys %final_list) {
Showalter [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25, 2002 05:45
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: another sort question (flame away)
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 24, 2002 5:31 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: another sort question (flame away)
>
>
> This should not matter what the si
riginal Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 13:54
To: [EMAIL PROTECTED]
Subject: Re: another sort question (flame away)
Nkuipers wrote:
>
> Hello all,
Hello,
> My hash keys look something like this:
>
> >1234 x5
>
>
Nkuipers wrote:
>
> Hello all,
Hello,
> My hash keys look something like this:
>
> >1234 x5
>
> So I am thinking a cmp, as opposed to <=> is best.
>
> What I want is for the keys to be sorted as follows:
>
> >1 x
> >2 x
> >3 x
> ..
> ..
> ..
> >n x
>
> This is what I have i
or just use my subroutine =P
> -Original Message-
> From: Bob Showalter [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 24, 2002 3:11 PM
> To: 'nkuipers'; [EMAIL PROTECTED]
> Subject: RE: another sort question (flame away)
>
>
> > -Ori
> -Original Message-
> From: nkuipers [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 24, 2002 3:03 PM
> To: [EMAIL PROTECTED]
> Subject: RE: another sort question (flame away)
>
>
> >Would trapping it an eval be what the doctor ordered?
>
> To ans
>From: nkuipers [mailto:[EMAIL PROTECTED]]
>
>>Would trapping it an eval be what the doctor ordered?
>
>To answer my own question, no, it would not.
>
>#use warnings;
>
>would be better.
It would probably be best to use
no warnings;
before the sort line in your script and
use warnings;
on the f
>Would trapping it an eval be what the doctor ordered?
To answer my own question, no, it would not.
#use warnings;
would be better.
=D
Hope y'all got a good chuckle out of it anyway.
"I think for my lunch tomorrow I'll make a tuna and pickle triangle bunwich."
--
To unsubscribe, e-mail: [
Bob wrote:
<=> should probably still work, because when evaluating a string
as a number, Perl will evaluate up to the first character that
doesn't look like part of a number. so "1234 x5" evalutates as
the number 1234 (stops at the space char).
*
I didn't know that. What I did after reading
yeah.. but that's not all I use it for
=P
> -Original Message-
> From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 24, 2002 1:22 PM
> To: [EMAIL PROTECTED]
> Subject: RE: another sort question (flame away)
>
>
> Nikola Janceski wr
Nikola Janceski wrote at Wed, 24 Jul 2002 19:45:54 +0200:
> not a dumb question... I actually have the same problem. I have version numbers that
>look like
> this:
>
> V1.2.3
> V1.2.20
> V1.2.23
>
> and it sorts it wrong with cmp and <=>
>
> soo.. I had to come up with my own sort subroutine
> -Original Message-
> From: nkuipers [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 24, 2002 1:39 PM
> To: [EMAIL PROTECTED]
> Subject: another sort question (flame away)
>
>
> Hello all,
>
> My hash keys look something like this:
>
> >
ordtype
> -Original Message-
> From: nkuipers [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 24, 2002 1:39 PM
> To: [EMAIL PROTECTED]
> Subject: another sort question (flame away)
>
>
> Hello all,
>
> My hash keys look something like this:
>
> >1234
If you want ascending numeric then <=> vs cmp ( ascii ) and you have
it.
Wags ;)
-Original Message-
From: nkuipers [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 10:39
To: [EMAIL PROTECTED]
Subject: another sort question (flame away)
Hello all,
My hash key
Hello all,
My hash keys look something like this:
>1234 x5
So I am thinking a cmp, as opposed to <=> is best.
What I want is for the keys to be sorted as follows:
>1 x
>2 x
>3 x
..
..
..
>n x
This is what I have in my script at the moment:
my @sort_this = keys %final_list;
m
Yep-- That did it.
THANK YOU!
gS
On Wednesday, July 18, 2001, at 09:35 PM, Jeff 'japhy/Marillion' Pinyan
wrote:
> On Jul 18, Groove Salad said:
>
>> sub normalize
>> {
>> my $file = shift;
>> my $s = sprintf("%02d",$1);
>> $file =~ s/^env-//;
>> $file =~ s/-(\d+)/$s/;
>>
On Jul 18, Groove Salad said:
>sub normalize
>{
> my $file = shift;
> my $s = sprintf("%02d",$1);
> $file =~ s/^env-//;
> $file =~ s/-(\d+)/$s/;
> return $file;
>}
The $1 variable is related to the (\d+) in the regex. You can't use it as
you have, since the regex hasn't happ
Hi:
I made the change and the env-mmdd-0 file is indeed the first in the loop. Now they are not incrementing:
The next file should be env-mmdd-1 env-mmdd-2 etc, but instead I'm getting this:
checking: env-20010712-0 for message, GDPN9D00.SRY
checking: env-20010712-0 for message, GDPN
On Jul 18, Groove Salad said:
>Thanks for the quick response. I think what you've described is a bit
>over my head. But, I'll try it and see what happens.
>
>The files will always be, env-mmdd-nn and will get rotated at months
>end. However, your solution much more flexible.
Since they'll
Thanks for the quick response. I think what you've described is a bit
over my head. But, I'll try it and see what happens.
The files will always be, env-mmdd-nn and will get rotated at months
end. However, your solution much more flexible.
Thanks again,
gS
On Wednesday, July 18, 2001,
On Jul 18, Groove Salad said:
>checking: env-20010712-0
>checking: env-20010712-1
>checking: env-20010712-10
>checking: env-20010712-11
>checking: env-20010712-12
[snip]
>checking: env-20010712-7
>checking: env-20010712-8
>checking: env-20010712-9
>
>How can I get them in numerical order? I tried
Hi All:
If I have files like the following:
checking: env-20010712-0
checking: env-20010712-1
checking: env-20010712-10
checking: env-20010712-11
checking: env-20010712-12
checking: env-20010712-13
checking: env-20010712-14
checking: env-20010712-15
checking: env-20010712-16
checking: env-20010
>I would like to sort the same using
> the last field (ie. lward, ohara, dray) starting with
> the 2nd character (ie from ward , hara and ray) :
Check out perldoc sort and perldoc substr. I think this will do what you
want
@sorted = sort {
$aname = (split /\s+/, $a)[-1];
$bname
$alt (sort {$a->[1] cmp $b->[1] } map{ [$_, /\s+\w(\w+)$/i ] }
@UnSorted) {
printf "%-s\n", $alt->[0];
}
Wags ;)
-Original Message-
From: Gustho [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 24, 2001 15:00
To: [EMAIL PROTECTED]
Subject: Unusual Sort question
Below is
On May 24, Jeff Pinyan said:
>Now the GRT looks like:
>
> @sorted =
>
># get rid of leading sorting string
>map { s/^\S+\s+// }
That should be
map { s/^\S+\s+//; $_ }
or even
grep { s/^\S+\s+// }
You can use grep() here since all lines will match that regex.
--
Jeff "jap
At 05:59 PM 5/24/01 -0400, Gustho wrote:
>Below is a sample directory listing of the mail folder
>on a Linux box, I would like to sort the same using
>the last field (ie. lward, ohara, dray) starting with
>the 2nd character (ie from ward , hara and ray) :
>
>-rw--- 1 lward mail0 May 24
On May 24, Gustho said:
>Below is a sample directory listing of the mail folder
>on a Linux box, I would like to sort the same using
>the last field (ie. lward, ohara, dray) starting with
>the 2nd character (ie from ward , hara and ray) :
>
>-rw--- 1 lward mail0 May 24 15:43 lward
>-rw
Below is a sample directory listing of the mail folder
on a Linux box, I would like to sort the same using
the last field (ie. lward, ohara, dray) starting with
the 2nd character (ie from ward , hara and ray) :
-rw--- 1 lward mail0 May 24 15:43 lward
-rw--- 1 ohara mail 8303 May
I'm not even sure if I understand your problem. Looks as if you already
solved most of it.
[EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
> Given the following text file:
>
> My first idea is to rebuild the array with a 'sortkey' pre-pended to each
> record, and then sorting this temp-array by th
: I need to sort all records by: 1) dept, name, record type.
: ...
: The real problem I have is with the "name" field being in one record only.
: The 'xx' values show that the name cannot be simply copied to the remaining
: records.
Try a two-pass solution: first create a hash that maps IDs to n
other stuff
56701xx Rother stuff
34502smith Dstuff
34502xx Eother stuff
34502xx Rmore stuff
-Original Message-
From: Steven.Spears@
dana.com [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 11:24
To: [EMAIL PROTECTED]
Subject: tough sort question
Given the following te
Given the following text file:
12301spears Dstuff
12301xx Rother stuff
12301xx Emore stuff
34502smith Dstuff
34502xx Eother stuff
34502xx Rmore stuff
56701jones Dstuff
56701xx Rother stuff
56701xx Emore stuff
and the following info:
chars (1-3) ID #
chars (4-5)
47 matches
Mail list logo