Unformatted text preview: p;
while (Head != 0)
tmp = Head;
Head = Head->next;
} Again no type.
The implementation must clean up all
dynamic } Here it is.
Applied Programming Let's look at an example to see the power of
Consider a supermarket with n checkouts.
Consider Applied Programming Ask for the size of the supermarket
cout << "How many checkouts? ";
cin >> n;
Create the required number of checkouts. Each checkout has its own queue. checkout = new LinkedList[n];
W e'll dynamically allocate the queues so that we
do not limit the number n.
int n; Applied Programming C++ will call the constructor for each of the n
entries, which we can refer to as
checkout, . . . checkout[i], . . .
Applied Programming Once we have carried out our simulation of the
supermarket, we can then free up our dynamically
allocated space by
which will invoke the de...
View Full Document
- Spring '14
- Object-Oriented Programming, Subroutine, Programming constructs, TimeType