Linked Lists Exercise list 75 35 86 10 50 28 65 39 current temp trail last Figur
ID: 3705501 • Letter: L
Question
Linked Lists Exercise list 75 35 86 10 50 28 65 39 current temp trail last Figure 1 Linked list for Exercise 6 through 14 6. What is the output, if any, of each of the following C++ statements? a. cout info; b. current = current-> link; cout info; c. cout link-> info; d. trail-> link nullptr: cout info; e. couts last -> link -> info; 8. What are the effects, if any, of each of the following C++ statements? a. train -> link nullptr delete last temp -> link train; list-> info = 19 current = current-> link; current -> link temp -> link; b. c. d.Explanation / Answer
6.
a ) Since current points to the first node which has 75 it prints 75
b) current->link assigns next node to the current to current then current->info prints 35
c) temp points to the node which has 86 then temp->link gives the next node which has info 10 then again operating ->link gives next node . Then its prints 50
d) trail->link - nullptr sets next node link to null . Then trail->info prints 65
e) last->link gives next node of last which is first node so it prints 75
8
a) trail->link = nullptr sets null and releases last node from the linkedlist. Delete last will delete the last node
b) temp->link = trail , sets node with the data 65 as next node to temp which is holding 86. So this detaches 3 nodes 10 50 and 28 from the list.
c) list->info = 19, updates its info to 19 from 75.
d) current = current->link moves current pointer to next node which is having info as 35.current->link = temp->link sets next node to current as node with info 28. Since in step b already we removed 3 nodes
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.