CPP-Recursive Reverse a Linked List

Why we are writing separately in the base case??
if(head->next == NULL || head == NULL)
What’s the difference??

@a19JE0093 suppose u are passed an empty linked list …u need head==null for that and head->next == null just says the linked list has ended

Understood Thank you so much

1 Like