Question: python please Write a function, printVals_v1 (head), which takes a linked list, and prints out its values, all in order. Use a loop. Then, write

python please Write a function, printVals_v1 (head), which takes a linked list,python please

Write a function, printVals_v1 (head), which takes a linked list, and prints out its values, all in order. Use a loop. Then, write a function, printVals_v2(head), which does exactly the same thing. But this time - just like last time - your function will handle a little bit of the work on its own: if the list is empty, return immediately. Otherwise, call printVals_v1(), and pass it the second node of the list. What will your new function need to do, in order to print the whole list? As before, test out your code. While it's not required that your answers be correct for an ICA, do your best! If you are able to make _v2() work properly, then make one more change: instead of calling _v1() with the second node, call _v2() instead. Yes, you read that right: make the function call itself! Now test your code. Does it still work? Discuss with your group why it does. Write a function, printVals_v1 (head), which takes a linked list, and prints out its values, all in order. Use a loop. Then, write a function, printVals_v2(head), which does exactly the same thing. But this time - just like last time - your function will handle a little bit of the work on its own: if the list is empty, return immediately. Otherwise, call printVals_v1(), and pass it the second node of the list. What will your new function need to do, in order to print the whole list? As before, test out your code. While it's not required that your answers be correct for an ICA, do your best! If you are able to make _v2() work properly, then make one more change: instead of calling _v1() with the second node, call _v2() instead. Yes, you read that right: make the function call itself! Now test your code. Does it still work? Discuss with your group why it does

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!