Linked list revisited
 

Example of a linked list:

 
 

Note:   the variable head is not a list element !

The actual linked list is:

 
                                      

Linked list is a recursive data structure
 

There is a smaller linked list contained inside a larger linked list:

 
 

 

(You have probably learned it in CS171)

Linked lists and recursive functions
 

Important consequence of the recursive nature of linked lists:

  • Recursive algorithms works best on problems/structures that are recurisve

  • Since a linked list is (by its nature) a recursive data structure, recursive algorithms will perform very very well (and simple) on linked list !!!