You could remove the need for the $pred variable altogether, if you work with a little more indirection. So something along these lines :-
while ( defined $curr ) { if ($curr->[NEXT]->[VALUE] == $value) { $curr->[NEXT] = $curr->[NEXT]->[NEXT]; } else { $curr = $curr->[NEXT]; }
You'll have to think about what happens at the start and end of your list.
The next thing to do is to write a sort by insertion routine ;)
In reply to Re: Linked List
by RichardK
in thread Linked List
by code-ninja
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |