GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Jun-2006, 01:10
febrarierose febrarierose is offline
New Member
 
Join Date: May 2006
Location: USA
Posts: 25
febrarierose is on a distinguished road

Help to translate an algorithm to a linked list format


Help ... I don't understand link list very well. Can someone help me how to translate an algorithm or explain how I can put them in linked list format?

Here is the algorithm:

1.) Set the next part of the node referred to by predptr equal to the next part of the node pointed to by ptr.
2.) Return the node pointed to by ptr to the storage pool.

The textbook I have don't have that much example that I can follow. Please help..

Thank you.
  #2  
Old 05-Jun-2006, 02:25
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,242
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Help to translate an algorithm to a linked list format


Definition:
predptr points to the previous node in the linked list
ptr points to the current node
nextptr (added for this discription) points to the next node in the linked list
In each, the next value points to the next node in the list -- from that node's standpoint. IOW
-- the next value in predptr points ptr
-- the next value in ptr points nextptr

Algorithm:
1) Take the current pointer's next value and copy it into the previous pointer's next value. This effectively makes the previous node's next value point to nextptr. This unlinks ptr from the linked list.
2) Delete ptr.
__________________

Age is unimportant -- except in cheese
 
 

Recent GIDBlogToyota - 2008 August Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 07:44
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 13:12
linked list error message Krandygrl00 C++ Forum 4 22-Jun-2005 14:13
search linked list itsmecathys C++ Forum 20 18-Apr-2005 01:34

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:39.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.