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...
Answer the following statements true (T) or false (F)
1. The mailx accepts input only from the keyboard. 2. While in mailx, you type x to remove mail from your mailbox. 3. While in mailx you can invoke the vi editor. 4. The command to read your mail is mailx -R.. 5. While in mailx you can execute other UNIX commands.
You should preview labels created through a mail merge before you print to avoid wasting expensive label sheets
Indicate whether the statement is true or false
The operation ____ initializes the queue to an empty state.
A. initializeQueue B. wipeQueue C. newQueue D. cleanQueue
Which of the following is the component of the processor that directs and coordinates most of the operations in the computer?
A. control unit B. concatenation unit C. compression unit D. micro unit