figure adding an item to an ordered linked list if current get_data(=itemfound true elseif current get_data(itemstop true elsecurrent current get_next( return found the most significant method modification will take place in add recall that for unordered liststhe add method could simply place new node at the head of the list it was the easiest point of access unfortunatelythis will no longer work with ordered lists it is now necessary that we discover the specific place where new item belongs in the existing ordered list assume we have the ordered list consisting of and and we want to add the value the add method must decide that the new item belongs between and figure shows the setup that we need as we explained earlierwe need to traverse the linked list looking for the place where the new node will be added we know we have found that place when either we run out of nodes (current becomes noneor the value of the current node becomes greater than the item we wish to add in our exampleseeing the value causes us to stop as we saw with unordered listsit is necessary to have an additional referenceagain called previoussince current will not provide access to the node that must be modified the below code shows the complete add method lines - set up the two external references and lines - again allow previous to follow one node behind current every time through the iteration the condition (line allows the iteration to continue as long as there are more nodes and the value in the current node is not larger than the item in either casewhen the iteration failswe have found the location for the new node the remainder of the method completes the two-step process shown in figure once new node has been created for the itemthe only remaining question is whether the new node will be added at the beginning of the linked list or some place in the middle againprevious =none (line can be used to provide the answer def add(selfitem)current self head previous none stop false basic data structures