algorithm traverse(head prehead is the head node in the list postthe items in the list have been traversed head while yield value next end while end traverse traversing the list in reverse order traversing singly linked list in forward manner ( left to rightis simple as demonstrated in ss howeverwhat if we wanted to traverse the nodes in the linked list in reverse order for some reasonthe algorithm to perform such traversal is very simpleand just like demonstrated in ss we will need to acquire reference to the predecessor of nodeeven though the fundamental characteristics of the nodes that make up singly linked list make this an expensive operation for each nodefinding its predecessor is an (noperationso over the course of traversing the whole list backwards the cost becomes ( figure depicts the following algorithm being applied to linked list with the integers and algorithm reversetraversal(headtail prehead and tail belong to the same list postthe items in the list have been traversed in reverse order if tail curr tail while curr head prev head while prev next curr prev prev next end while yield curr value curr prev end while yield curr value end if end reversetraversal this algorithm is only of real interest when we are using singly linked listsas you will soon see that doubly linked lists (defined in ss make reverse list traversal simple and efficientas shown in ss doubly linked list doubly linked lists are very similar to singly linked lists the only difference is that each node has reference to both the next and previous nodes in the list