inserting an element at the tail of singly linked list we can also easily insert an element at the tail of the listprovided we keep reference to the tail nodeas shown in figure in this casewe create new nodeassign its next reference to noneset the next reference of the tail to point to this new nodeand then update the tail reference itself to this new node we give the details in code fragment tail msp atl bos (atail msp atl newest bos mia (btail msp atl bos newest mia (cfigure insertion at the tail of singly linked list(abefore the insertion(bafter creation of new node(cafter reassignment of the tail reference note that we must set the next link of the tail in (bbefore we assign the tail variable to point to the new node in (calgorithm add last(le)newest node( {create new node instance storing reference to element enewest next none {set new node' next to reference the none objectl tail next newest {make old tail node point to new nodel tail newest {set variable tail to reference the new nodel size size {increment the node countcode fragment inserting new node at the end of singly linked list note that we set the next pointer for the old tail node before we make variable tail point to the new node this code would need to be adjusted for inserting onto an empty listsince there would not be an existing tail node