Question
The following recursive function inserts a value as the last item in a linked implementation of a list. Read the following code and determine what
The following recursive function inserts a value as the last item in a linked implementation of a list. Read the following code and determine what goes in blank #4.
void Insert(NodeType*& listNode, ValueType value)
// Pre: listNode is defined.
// listNode is a pointer to a list.
// Post:value is inserted in a node, which is placed at the end of the list
{
if (listNode == ________) // 1
{
listNode = _______ NodeType; // 2
____________ = value; // 3
____________ = NULL; // 4
}
else Insert(___________, value); // 5
}
[1] listNode->next
[2] listNode->info
[3] value
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started