On Mon, Mar 17, 2008 at 10:34 AM, Sharan Basappa
<[EMAIL PROTECTED]> wrote:
> Rob,
>
> Actually you are correct. I was on my way to implement permutation for
> a given set of numbers.
> In that context, I had designed my own algo as a part of bigger
> problem I am trying to solve.
> That algo
Rob,
Actually you are correct. I was on my way to implement permutation for
a given set of numbers.
In that context, I had designed my own algo as a part of bigger
problem I am trying to solve.
That algo requires rotate and factorial. Rotate to get different
combinations and factorial to limit for
Sharan Basappa wrote:
>
Thanks everybody. I need to use these as a part of algo I am working
on. I will get back if I have any comments ..
Rotating an array and calculating a factorial are both likely to absorb
large amounts of processor time unless your problem is trivial. I'm also
intrigued t
Thu, 13 Mar 2008 18:06:27 +0530
> > From: "Sharan Basappa" <[EMAIL PROTECTED]>
> > To: beginners@perl.org
> > Subject:functions: rotate and factorial
> >
> >
> > &
2008/3/13, Jenda Krynicky <[EMAIL PROTECTED]>:
>
> Date sent: Thu, 13 Mar 2008 18:06:27 +0530
> From: "Sharan Basappa" <[EMAIL PROTECTED]>
> To: beginners@perl.org
> Subject: functions: rotate an
On Thu, Mar 13, 2008 at 9:02 AM, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
snip
> right
> @a = (pop(@a), @a);
>
> left
> @a = (@a[1..$#a], $a[0]);
snip
These are O(n) operations and are fine if n is small, but the push/shift and
unshift/pop implementations are O(1). Of course, the push/shift
Date sent: Thu, 13 Mar 2008 18:06:27 +0530
From: "Sharan Basappa" <[EMAIL PROTECTED]>
To: beginners@perl.org
Subject: functions: rotate and factorial
> Hi,
>
> I was wondering if perl has support for t
On Thu, Mar 13, 2008 at 8:36 AM, Sharan Basappa
<[EMAIL PROTECTED]> wrote:
snip
> - rotate: the elements of a given array are shifted such the elements
> are shifted right or left
> and the last/first element fill the first/last position depending on
> whether shift right or shift left is
> do
Hi,
I was wondering if perl has support for the following operators or functions:
- rotate: the elements of a given array are shifted such the elements
are shifted right or left
and the last/first element fill the first/last position depending on
whether shift right or shift left is
done.
- fact