< previous page
page_1114
next page >
Page 1114
lastPtr->number = 9;
firstPtr = new NodeType;
lastPtr->link = firstPtr;
firstPtr->number = 9;
firstPtr->character = h;
firstPtr->link = currPtr;
.
.
.
Expression
Value
a.
firstPtr->link->number
_____
b.
firstPtr->link->link->character
_____
c.
firstPtr->link == lastPtr
_____
d.
currPtr->link->number
_____
e.
currPtr->link == *lastPtr
_____
f.
firstPtr == lastPtr->link
_____
g.
firstPtr->number << firstPtr->link->number
_____
8. Choose the best data structure (array or dynamic linked list) for each of the following situations. Assume unlimited memory but limited time.
a. A list of the abbreviations for the 50 states.
b. A fixed list of 1000 to 4000 (usually 1500) elements that has elements printed according to position requests that are input to the program.
c. A list of an unknown number of elements that is read, then printed in reverse order.
9. Choose the best data structure (array or dynamic linked list) for each of the following situations. Assume limited memory but unlimited time.
a. A list of the abbreviations for the 50 states.
b. A fixed list of 1000 to 4000 (usually 1500) elements that has elements printed according to position requests that are input to the program.
c. A list of an unknown number of elements that is read, then printed in reverse order.
10. What is the output of the following C++ code, given the input data 5, 6, 3, and 1?
struct PersonNode;
typedef PersonNode* PtrType;
struct PersonNode
{
int ssNum;
PtrType next;
};
int ssNumber;
PtrType ptr;
PtrType head = NULL;
< previous page
page_1114
next page >