0
29kviews
Write algorithm to insert a new node in linked list at the beginning, and at the end.
written 6.1 years ago by | • modified 5.1 years ago |
ADD COMMENT
EDIT
1 Answer
PROCEDURE (insert-node-as-a-first-node) ( list, link, info,new, item)
//List = given single link list //Link = link part of the node //info = information part of the node //new = newly created node //item = item to be inserted at first position of a linked list
Step 1[checking for overflow] If (new==NULL) a. print overflow b. Goto step 4 [End of if statement]
Step 2 new -> info =item New->link = NULL Step 3 New->link=start Start= new Step 4 Exit