Algorithms

Moderators: None (Apply to moderate this forum)
Number of threads: 402
Number of posts: 786

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
linked list Posted by kudakwashe on 14 Mar 2006 at 7:43 AM
hie
how do i insert and delete any node between the first node and last node in the list.
Report
Re: linked list Posted by Dipalee on 21 Mar 2006 at 11:52 PM
If you want to insert "new" node after "current" node, then your logic would be
new->next = current->next
current->next = new

if you want to delete "current" node which comes after "previous", then your logic would be
previous = current
current = previous->next
previous->next = current->next
Dipalee




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.