adding nodes adding nodes to an ordered circular linked list is very similar to that of the ordered linear versions the major difference is the management of the loopback link from the last node to the first the implementation is much simpler if we divide it into four casesas illustrated in figure ( the list is empty when adding the node( the new node is inserted at the front( the new node is inserted at the endor ( the node is inserted somewhere in the middle the first three cases are straightforward and only require few adjustments in the links the fourth case requires search to find the proper location for the new node and the positioning of the two external reference variables this requires traversal similar to the one used earlier with the search operation the python code segment shown in listing provides the implementation of the insert operation it should be noted again that the illustrations show the ordering in which the links should be made to avoid accidentally unlinking and destroying existing nodes in the list listing inserting node into an ordered circular linked list given listref pointer and valueadd the new value to an ordered circular linked list newnode listnodevalue if listref is none empty list listref newnode newnode next newnode elif value listref next data insert in front newnode next listref next listref next newnode elif value listref data insert in back newnode next listref next listref next newnode listref newnode else insert in the middle position the two pointers prednodenone curnode listref done listref is none while not done prednode curnode prednode curnode next done curnode is listref or curnode data target adjust links to insert the node newnode next curnode prednode next newnode removing nodes deleting node from circular linked listfor both ordered and unordered listsclosely follows the steps required for inserting node into an ordered circular list the implementation of this operation is left as an exercise