Given an array a={5, 10, 15, 20}, write a C++code to build a linklist with the v
ID: 3608995 • Letter: G
Question
Given an array a={5, 10, 15, 20}, write a C++code to build a linklist with the values come from array a. Thenusing the recursive method to print the list in reverse order.Which means the 20 will be print out first, and 5 will be print outlast. Reply Soon Given an array a={5, 10, 15, 20}, write a C++code to build a linklist with the values come from array a. Thenusing the recursive method to print the list in reverse order.Which means the 20 will be print out first, and 5 will be print outlast. Reply SoonExplanation / Answer
//Hope this will help you.. #include using namespace std; struct node{ int n; struct node *next; }*first=NULL,*ptr; void insert(int *arr,int count) { int i; ptr=first; for(i=0;in = arr[i]; first->next=NULL; ptr=first; }else { ptr->next = new struct node; ptr=ptr->next; ptr->n = arr[i]; ptr->next=NULL; } } } void print_list(struct node *ptr){ if(ptr==NULL) return; print_list(ptr->next); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.