Use the following type declaration to write your function. The function should c
ID: 3611887 • Letter: U
Question
Use the following type declaration to write your function. The function should contain pre and post-conditions as comments atthe top.
struct node
{
int info;
node *next;
node *back;
node (int D, node *N)
: info (D), next (N)
{ }
};
node *list;
Given a singly-linked linear list, write a function to convertit to a circular list.
Explanation / Answer
node *temp; temp = list; //find the last node and make doubly linked along the way while(temp->next != NULL){ (temp->next)->back = temp; //make doubly linked temp = temp->next; //move to next node } //at the last node temp->next = list; //make circular list->back = temp;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.