Question: Write a function, count_v1(head), which takes a linked list as a parameter (remember, it might be empty!). Count up how many nodes it has, and
Write a function, count_v1(head), which takes a linked list as a parameter (remember, it might be empty!). Count up how many nodes it has, and return the count.
Once you have that completed, write a second function, which does the exact same thing - but does it a different way. In this function, count_v2(), you must handle the function locally if the list is empty. But if the list is not empty, you must call count_v1(), passing it the second node in the list. Save what it returns to you, and then return the proper value to your own caller. How should you modify the return value that youre given, so that you return the correct value?
python please
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
