Algorithm for inserting a node at the Specified Position


Step 1: [Check for overflow ]
        IF PTR == NULL, then 
           print 'OVERFLOW' 
           EXIT 
        else
           PTR = (NODE *) malloc (size of (node))
        [END OF IF]
Step 2: SET PTR -> INFO = ITEM 
Step 3: IF START = NULL then
           SET START = P
           SET P -> NEXT = NULL
        [END OF IF] 
Step 4: Initialise the counter (I) and pointers (NODE * TEMP)
          SET I = 0
          SET TEMP = START 
Step 5: Repeat steps 6 and 7 until I<loc 
Step 6: SET TEMP = TEMP -> NEXT
Step 7: SET i = I+1 
Step 8: SET P -> NEXT = TEMP -> NEXT 
Step 9: SET TEMP -> NEXT = P 
Step 10: EXIT