Board index » delphi » Dummy nodes(link ed list);

Dummy nodes(link ed list);

Hi, i'm really confuse on how to use dummy nodes , i have to procedure and
function with a dummy nodes. Can any one please  write  me a sample of these
two procedure, because i just don't get it;
i need a procedure :
 insert with a dummy nodes in the list
 delete with a dummy nodes  in the list

notice that my professor rewrote the inser and delete, so insert doesn't
actually insert anything in the list, it just link up with a temporary
pointer who has the value you want to insert.i still don' t know why he
changed it like that.
Any help would be appreciated .

Thank you for your time ,
Armel A.
 my e-mail is Ar...@dreamscape.com

 

Re:Dummy nodes(link ed list);


We won't do your assignments for you; however, i can impart some insight into
your issue.
  A dummy node is used in a linked list to designate the beginning of the list.
 It contains no other information but the location of the "first" node in it's
next pointer. It helps in the "special" case of trying to insert into the
"first" node, because the "first" node is in actuality the second node.
Confusing?
   Think about what happens with a "generic" Insert method.
    PrevNode.Next:=InsertedNode;
    InsertedNode.Next:=CurrentNode;
Right?
Now, what happens if PrevNode doesn't exist?(First Node Case)
  A dummy node at the beginning of the list prevents this problem from
occuring.  Are the lights coming on now?  If so, Go forth and do write good
code, and God Speed;  If not, have a chat with your Prof one on one for more
enlightenment.

Other Threads