Consider a linked chain of three nodes, such that each node contains a string.The first node contains "A", the second node contains "B", and the third node contains "C".
a. Write C++ statements that create the described linked chain. Beginning with a head pointer headPtr that contains nullptr, create and attach a node for "C", then create and attach a node for "B", and finally create and attach a node for "A".
b. Repeat part a, but instead create and attach nodes in the order "A", "B", "C".
```
// Part a: Create nodes for C, B, and A; insert nodes at beginning of chain.
headPtr = new Node
Node
newNodePtr->setNext(headPtr);
headPtr = newNodePtr;
newNodePtr = new Node
newNodePtr->setNext(headPtr);
headPtr = newNodePtr;
// Part b: Create nodes for A, B, and C; insert nodes at end of chain.
headPtr = new Node
Node
headPtr->setNext(newNodePtr);
Node
newNodePtr = new Node
lastNodePtr->setNext(newNodePtr);
```
You might also like to view...
An announcements ________ is used to inform SharePoint site users about upcoming events, news, or activities
A) item B) list C) zone D) page
What is the best definition of privileged information?
a. Any documents or other material evidence that both parties are privileged to examine. b. Any documents or other material evidence that, while otherwise defined by a discovery motion, may be withheld from evidence due to the nature of the material. c. Any documents or other material evidence that have been identified in a legally obtained electronic discovery order. d. Any documents prepared by an attorney.