Consider the following code: // Linked Lists: TRAVERSE
struct ListNode { int data; struct ListNode *next; };
Assume that a linked list has been created and head points to a sentinel node. A sentinel node is an empty data node in the beginning of the list. It sometimes holds a sentinel value. The use of sentinel nodes is a popular trick to simplify the insert and delete operations.
You may also assume that the list is not empty. Each node in the list contains an integer representing a digit in a number. The data in the sentinel node is -1.
For instance, n = 234 will be stored as {-1, 4, 3, 2} in the linked list.
Write a function based on the list traversal named computeNumFromList that is passed the pointer to the first node in the list, it prints the digits in the list one per line, and it returns a long integer, the number calculated from its digits in the list (234 see the above example). You may assume that long int will hold the converted number (no need to check for numeric overflow).