Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Linked list in Perl

by grizzley (Chaplain)
on Sep 28, 2012 at 12:21 UTC ( #996195=note: print w/ replies, xml ) Need Help??

in reply to Linked list in Perl

Linked list is best if you need to add at the end and pick from beginning. If you want to insert/remove elements in the middle you have to travel from the beginning and if you are at desired element C (after which you want to insert new element N) just copy link to next element from C to N, set link to next element in C to N and you are done. So you want to change

C -> nextElem


C -> N -> nextElem

Comment on Re: Linked list in Perl

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-11-30 14:59 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (774 votes), past polls