recursion using software stack using recursion in solving problems is very similar to using the software implemented stack structure in factany solution that can be implemented using stack structure can be implemented with recursionand vice versa consider the problem of printing in reverse order the items stored in singly linked list such as the one shown in figure head figure sample singly linked list since the links are in one directionwe cannot easily access the nodes in reverse order brute-force approach to solving this problem would be to use nested loops to iterate over the linked list multiple times with each iteration of the inner loop ending one node shorter than previous iteration this approach is implemented by the function in listing but it has run time of ( listing brute-force approach for printing singly linked list in reverse order print the contents of singly linked list in reverse order def printlistbfhead )count the number of nodes in the list numnodes curnode head while curnode is not none curnode curnode next numnodes + iterate over the linked list multiple times the first iteration prints the last itemthe second iteration prints the next to last itemand so on for in rangenumnodes )the temporary pointer starts from the first node each time curnode head iterate one less time for iteration of the outer loop for in rangenumnodes )curnode curnode next print the data in the node referenced by curnode printcurnode data