Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^9: [OT:] Is this Curriculum right?

by ikegami (Patriarch)
on Nov 28, 2021 at 01:42 UTC ( [id://11139183]=note: print w/replies, xml ) Need Help??


in reply to Re^8: [OT:] Is this Curriculum right?
in thread [OT:] Is this Curriculum right?

Perl arrays use a doubling trick to ensure that push and unshift are near O(1) like with linked lists.

Unshifts are O(1).

Unshifts and pushes are amortized O(1) (meaning O(N) to do N of them).

Replies are listed 'Best First'.
Re^10: [OT:] Is this Curriculum right?
by LanX (Saint) on Nov 28, 2021 at 05:33 UTC
    > Unshifts are O(1).

    Please explain why not "amortized O(1)", the cases are symmetric.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Sorry, was thinking of shift.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2026-05-11 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.