Question: if all the following nodes are integer nodes, and the print function prints the list from the beginning What is the output of the following

if all the following nodes are integer nodes, and the print function prints the list from the beginning
What is the output of the following code
node* p=new node(0);
node *head=new node(p->data);
node *ptr=head;
for(int i=1;i<=5;i++)
{
p->next=new node(i+p->data);
p=p->next;
ptr->next=new node(i+head->data);
ptr=ptr->next;
ptr->data=p->data+head->data;
}
p->next=head;
print(p);
Question 12Answer
a.
None of these
b.
15026122030
c.
1501361015
d.
15012345

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!