Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Problem Complete the function stringList that accepts a Node (the head of a

ID: 3753906 • Letter: T

Question

The Problem Complete the function stringList that accepts a Node (the head of a linked list) as a parameter and creates a string out the list in the following format Node 0: 100 Node 1: 200 -Node 2: 300 If the list is empty then the function should return "Empty list". Testing Your Code This time we do not provide you with local test cases. You should write your own test cases. In main.cpp, you should test your stringList in, at least, the following cases: An empty list A list with exactly one node .A list with more than one node (eg: 100 ->200->300, as shown above) We will not be checking your main function.

Explanation / Answer

string stringlist (struct node* head)
{
if(head==NULL) return "Empty List";
printf("%d",head->data);
stringlist(head->next);
}
// function shows how to print or get list data using a pointer recursively
//since you know to print data you can append it to your string

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote