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

C++, your help will be great.Thanks in advance! exercise 1 What are the effects,

ID: 664770 • Letter: C

Question

C++, your help will be great.Thanks in advance!

exercise 1

What are the effects, if any, of each of the following C++ statements?
a. trail->link = NULL;
delete last;
b. temp->link = trail;
c. list->info = 19;
d. current = current->link;
current->link = temp->link;

What is the output of the following C++ code?
e. while (current != NULL)
cout << current->info << " ";
current = current->link;
cout << endl;
f. while (current != last)
current = current->link;
cout << current->info << " ";
cout << endl;


Consider the linked list shown in Figure 16-50. Assume that the nodes are in the ustual info-link form. Use this list to answer Exercises 6 through 14. If necessary, declare additional are in the usual variables. (Assume that list, current, temp, trail, and last are pointers of type nodeType.) list 10 50 28 65 3 9 75 35 trail last temp current

Explanation / Answer

a. trail->link = NULL;
delete last;

Currently trail point to next node that is last node . Last is not null so condition is false .It won't be delete last node

b. temp->link = trail;

As per statement Temp node point too trail but as per screen shot temp node link to another node .

Temp node (86) ----> Node(10)

C. list->info = 19;

   As per given linked list list valiue is not 19

D. current = current->link;
    current->link = temp->link;

Current = 35

temp->link = 10

Current is point to next node and Next node is 35

Temp point to the next node that is 10 so here Current link is 10 so that is not valid

e.while (current != NULL)
cout << current->info << " ";
current = current->link;
cout << endl;

Output - > 75

Reason- As per while condition checking Current node is not null ..condition is true.then go to loop and print current node value that is 75

F. while (current != last)
current = current->link;
cout << current->info << " ";
cout << endl;

Output = 35

Reason -> As per while loop checking condition that Current node is not equal to last ..condition is true.then go to loop and print current node pointer.Current node point to next node that's value is 35

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