a. myList.InsertTop(30); b. myList.Insert(10);
myList.InsertTop(20); myList.Insert(20);
myList.InsertTop(10); myList.Insert(30);
myList.Print(); myList.Print();
2. In a linked list, components are only logically next to each other, whereas in an array they are also physically next to each other. (True or False?)
3. Which of the following can be used to implement a list ADT?
a. An array of the component type
b. A linked list implemented using an array of structs
c. A linked list implemented using dynamic structs and pointers
4. The following declarations for a node of a linked list are not acceptable to the C++ compiler:
typedef T* P;
struct T
{
float x;
P link;
};
Correct the problem by inserting another declaration before the Typedef statement.
5. What is the primary benefit of dynamic data structures?
6. This chapter's OrdList class represents an ordered list ADT. To make an unordered list ADT, which of the following member functions could be removed: IsEmpty, Print, InsertTop, Insert, DeleteTop, and Delete?
7. Use the C++ code below to identify the values of the variables and Boolean comparisons that follow. The value may be undefined, or the expression may be invalid.
struct NodeType;
typedef NodeType* NodePtr;
struct NodeType
{
int number;
char character;
NodePtr link;
};