Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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 drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2015-12-01 11:54 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (6 votes), past polls