Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

•Re: Re: (OT) Interview questions -- your response?

by merlyn (Sage)
on Sep 03, 2002 at 22:02 UTC ( #194919=note: print w/replies, xml ) Need Help??


in reply to Re: (OT) Interview questions -- your response?
in thread (OT) Interview questions -- your response?

@array[0..$#array] = @array[reverse 0..$#array]; That's *not* a built-in array-reversal method.
Nor it it an "in-place" reversing method, failing the requirements of the question. You've made an entire copy of the array in a different part of memory.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: •Re: Re: (OT) Interview questions -- your response?
by Anonymous Monk on Sep 03, 2002 at 22:40 UTC
    True enough, and not an unexpected claim. Though one *could* argue that:
    @array[$left,$right] = @array[$right,$left];

    Isn't any more "in-place", as it is the same thing when the array is only two elements. And I didn't see where using a constant amount of additional memory was part of the requirement :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://194919]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2019-06-25 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (107 votes). Check out past polls.

    Notices?