RamAllu401
12/10/2019 - 6:13 AM

Reverse of a LL using recursive method

void Reverse(struct node* p)
{
	//exiting condition
	if (p->next == NULL)
	{
		HEAD = p;
		return;
	}
	Reverse(p->next);
	struct node* q;
	q = p->next;
	//This null is used to make last node point to NULL
	p->next = NULL;
	q->next = p;
}