Converting Recursive Function

I have a recursive function here, but it is causing overflow errors so I need to change it into a non-recursive function. Any help on how to do that will be greatly appreciated!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void MergeSort(struct node** headRef)
{
	node* head = *headRef;
	node* a;
	node* b;
	if ((head == NULL) || (head->next == NULL))
	{
		return;
	}

	FrontBackSplit(head, &a, &b);
	MergeSort(&a);
	MergeSort(&b);
	*headRef = SortedMerge(a, b);
}
Topic archived. No new replies allowed.