...

/

Test Your Knowledge 6

Test Your Knowledge 6

Let's take a small Quiz!

Quiz on Recursion with Data Structures

This Quiz will take maximum 10 minutes.

1.

Assume that we have a linked list with 55 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

1 / 4

We have reached the end of the course. In the next lesson there is brief overview of more on recursion.