[int count(Node * list)
{
if (list == Null)
return 0;
else
return 1 + count(list->next);
}
Write a recurrence relation for the function count.]

So, what is the behavior of the function when the list is empty? Can you define the behavior of the function in relation to a function call on a list that is closer to being empty? The function is defined recursively; a recurrence relation is just another way of writing a recursive function definition, only in math notation instead of pseudo-code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.