Quick Quiz on Recursion with Data Structures!
This lesson will test your knowledge on how to solve linked list, trees ,and graph problems using recursion.
We'll cover the following...
Solve this Quiz!
1
Assume that you have a linked list with five nodes. The task is to traverse the linked list recursively.
void printListRecursively(Node* head)
{
//base case
//recursive case
cout << head->data <<endl;
printListRecursively(head->next);
}
What would be the base case of the above code?
A)
if (head==NULL)
{
return;
}
B)
if (head->next==NULL)
{
return;
}
Question 1 of 30 attempted
Access this course and 1400+ top-rated courses and projects.