while current !none and not stopif current get_data(itemstop true elseprevious current current current get_next( temp node(itemif previous =nonetemp set_next(self headself head temp elsetemp set_next(currentprevious set_next(tempanalysis of linked lists to analyze the complexity of the linked list operationswe need to consider whether they require traversal consider linked list that has nodes the is_empty method is ( since it requires one step to check the head reference for none sizeon the other handwill always require steps since there is no way to know how many nodes are in the linked list without traversing from head to end thereforelength is (nadding an item to an unordered list will always be ( since we simply place the new node at the head of the linked list howeversearch and removeas well as add for an ordered listall require the traversal process although on average they may need to traverse only half of the nodesthese methods are all (nsince in the worst case each will process every node in the list you may also have noticed that the performance of this implementation differs from the actual performance given earlier for python lists this suggests that linked lists are not the way python lists are implemented the actual implementation of python list is based on the notion of an array we discuss this in more detail in another summary linear data structures maintain their data in an ordered fashion stacks are simple data structures that maintain lifolast-in first-outordering the fundamental operations for stack are pushpopand is_empty queues are simple data structures that maintain fifofirst-in first-outordering the fundamental operations for queue are enqueuedequeueand is_empty prefixinfixand postfix are all ways to write expressions stacks are very useful for designing algorithms to evaluate and translate expressions stacks can provide reversal characteristic summary