Question: We dont really need a real one-past-the-end Link for a list. Modify your solution to the previous exercise to use 0 to represent a pointer

We don’t really need a “real” one-past-the-end Link for a list. Modify your solution to the previous exercise to use 0 to represent a pointer to the (nonexistent) one-past-the-end Link (list::end()); that way, the size of an empty list can be equal to the size of a single pointer.


Data from Previous Exercise

Complete the definition of list from §20.4.1–2 and get the high() example to run. Allocate a Link to represent one past the end.

Step by Step Solution

3.49 Rating (172 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

struct Link int data Link pre Link suc class list public list first new Link first pre 0 first s uc ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Principles and Practice Questions!