would you mind giving an example of this Pseudo code

--- On Thu, 5/7/09, Benjamin Scott <[email protected]> wrote:
From: Benjamin Scott <[email protected]>
Subject: Re: [c-prog] Re: linked list
To: [email protected]
Date: Thursday, May 7, 2009, 11:49 PM











    
            
            


      
      

Follow this Pseudo code:



InsertBefore:

--Create The Node to be added.

--Set Next pointer of This Node to the Linked List Pointer.

--set Linked List pointer to Created Node



InsertAfter

--Create The Node to be added

--Use a Temporary Pointer to follow the Linked list down

NOTE: This Temporary point must not equal NULL, NIL, 0, 

------or any other symbol specifying NOTHING.

--Set the Temporary Pointer's Next pointer to Created Node



DeleteFirstNode

--Temporary Pointer = Linked List Pointer's Next pointer

--Dispose Linked List Pointer Data

--Linked List Pointer = Temporary Pointer



DeleteSpecifiedNode :

--Loop Pointer = Linked List Pointer's Next Pointer

--Previous Loop pointer = Linked List Pointer

--Loop

-----If Loop Pointer is to be deleted then

--------Previous Loop Pointer's next pointer = Loop Pointer's Next Pointer

--------dispose Loop Pointer

-----else

-------Previous Loop Pointer = Loop Pointer

-----end if

-----Loop Pointer = Previous Loop Pointer's Next Pointer

--End Loop when U reach the End of the Linked List

--if Linked List Pointer is to be Deleted then

-----Temporary Pointer = Linked List Pointer's Next pointer

-----Dispose Linked List Pointer Data

-----Linked List = Temporary Pointer

--end if



Please Understand that this MAY be seem

difficult to follow,  but I learned how 

to do this  with  a  Paper  and  pencil: 

This  should be  easy to  follow in that 

way.   Remember  that  each  Value(Node) 

points to another Value(Node).




 

      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to