Doubt in Q6 Kindly Resolve

Predict the output that the following code gives for a linked list given as 1->2->3->4->5->6
cpp

void fun(node* start)
{
if(start == NULL)
return;
cout<data<<" “;
if(start->next != NULL )
fun(start->next->next);
cout<data<<” ";
}
Java

void fun(node start)
{
if(start == null)
return;
System.out.print(start.data+" “);
if(start.next != null )
fun(start.next.next);
System.out.print(start.data+” ");
}

This question what language is used ? Java doesn’t have pointers and Cpp doesn’t have sopln . ???

Hi… this syntax is of Java only…

But then node * ? because I don’t think java allows for pointers also right ?

ya… actually they seem to have mixed java and c++… is just a output ques and they want u to just consider logic… forget about syntax for a min and just think of its o/p

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.