Test Your Knowledge 6
Let's take a short Quiz!
We'll cover the following...
...
This Quiz will take approximately 10 minutes.
1
Assume that you have a linked list with nodes. Your task is to traverse the linked list recursively.
def printListRecursively(head) :
# Base case
_______________________________________
# Recursive case
print(str(head.data) + " ")
printListRecursively(head.next)
What would the base case of the above code be?
A)
if not head :
return
B)
if not head.next :
return
C)
if not print:
return
D)
if not head :
return 1
Question 1 of 40 attempted
...
Access this course and 1400+ top-rated courses and projects.