Test Your Knowledge 6
Let's take a small Quiz!
We'll cover the following
Quiz on Recursion with Data Structures
This Quiz will take maximum 10 minutes.
1
Assume that we have a linked list with nodes. Our task is to traverse the linked list recursively.
def printListRecursively(head) :
# Base case
_______________________________________
# Recursive case
print(str(head.data) + " ")
printListRecursively(head.next)
What would be the base case of the above code?
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
We have reached the end of the course. In the next lesson there is brief overview of more on recursion.