Chapter 4 Questions
True or False
1. A node can be dynamically allocated.
2. Before you can assign headPtr a value, you must first create a new Node object.
3. Generally speaking, a link-based implementation does not impose a fixed maximum size on the
data structure.
4. Like an array-based implementation, a link-based implementation’s insertion and removal
operations will need to move data items.
5. For a link-based bag, the most convenient place to make an insertion is at the beginning of the
chain.
6. Even though you have allocated memory by using new, there is no need to deallocate it with the
delete command.
7. The method clear cannot simply set ItemCount to zero.
8. A class can have multiple destructors.
9. According to the text, you must write a destructor if your class allocates memory dynamically.
10. Classes that use dynamically allocated memory can depend on the compiler-generated destructor.
11. The copy constructor for our bag class requires traversing the original linked chain and
duplicating each node visited.
12. A recursive version of toVector is complicated and requires invocation of the copy
constructor.
13. Access time is a constant for an array-based implementation.
14. A link-based implementation requires less memory than an array-based implementation.