The printList() function takes a linked list as input and prints the elements of the list till NULL pointer is encountered. Here the traversal is in a sequential manner.
The head pointer points to the first node. To traverse the list follow the pointers and display the contents of the node.
Time complexity: O(n), for scanning the list of size n
Space complexity: O(1), for creating a temporary variable
|C Programming language
|Go Programming language