6. No, the class definition would not have to be changed. Only the definition of NodeType would have to be changed.
* ptr2;
if (topPtr == NULL)
anotherStack.topPtr = NULL;
else
{
anotherStack.topPtr = new NodeType;
anotherStack.topPtr->info = topPtr->info;
ptr1 = topPtr->next;
ptr2 = anotherStack.topPtr;
while (ptr1 != NULL)
{
ptr2->next = new NodeType;
ptr2 = ptr2->next;
ptr2->info = ptr1->info;
ptr1 = ptr1->next;
}
ptr2->next = NULL;
}
}
12. (a) Doubly linked
(b) Circular
(c) List with header and trailer
15. (b)
(c)
-
|
free
|
3
|
|
|
list
|
1
|
|
|
nodes
|
|
|
.info
|
.next
|
.back
|
[0]
|
17
|
2
|
1
|
|
[1]
|
4
|
0
|
NUL
|
|
[2]
|
25
|
NUL
|
0
|
|
[3]
|
|
|
|
|
[4]
|
|
|
|
|
[5]
|
|
|
|
|
[6]
|
|
|
|
|
[7]
|
|
|
|
|
[8]
|
|
|
|
|
[9]
|
|
|
|
|
(d)
-
|
free
|
0
|
|
|
list
|
1
|
|
|
nodes
|
|
|
.info
|
.next
|
.back
|
[0]
|
17
|
3
|
1
|
|
[1]
|
4
|
2
|
NUL
|
|
[2]
|
25
|
NUL
|
1
|
|
[3]
|
|
|
|
|
[4]
|
|
|
|
|
[5]
|
|
|
|
|
[6]
|
|
|
|
|
[7]
|
|
|
|
|
[8]
|
|
|
|
|
[9]
|
|
|
|
|
17. Static binding is the determination of which function to call at compile time; dynamic binding is the determination of which function to call at run tim