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

Write recursive functions that perform insertion and retrieval operations on a p

ID: 3661068 • Letter: W

Question

Write recursive functions that perform insertion and retrieval operations on a pointer-based sorted linked list of integers. The insertion function should be void, taking a head pointer and the item to be inserted as parameters. The retrieval function should take a head pointer and the item to be retrieved as parameters, and should return the item's position, or -1 if the item is not found in the list. Use these procedures to write a program that inputs a series of integers, inserting them into a list until 0 is entered. Then a second series of integers is input, until 0 is entered, and the position of each integer in the list is displayed. Example: Enter numbers to be inserted (0 to end): 34 23 1 45 7 0 The list is: 1 7 23 34 45 Enter numbers to be retrieved (0 to end): 23 8 45 0 23 is at position 3 8 is not in the list 45 is at position 5 Note that the program should be able to handle requests to retrieve items that are not in the list

Explanation / Answer

void recurse(int * head,int inspara[],int retpara[],int n,int insert,int ret) { for(int i=0,i>inspara[i]; } for (int j=0;j>retpara[j]; } for(i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote