IT Girl
15-10-2004, 06:46 AM
The linked list provides a more flexible storage system, the space for each data item is obtained as needed with new, and each item is connected, or linked, to the next data item using a pointer.
We need to create a linked list class (called linklist )
The individual data items, or links, are represented by structures of type link. Each structure contains an integer- representing the object’s single data item and a pointer to the next link.
The list itself stores a pointer to the link at the head of the list.
The class should contain functions that do the following:
Construct the list, leaving it empty.
Overload the constructor that permits to make the first node with a given data.
Determine whether the list is empty or not.
Find the size of the list.
Insert an entry at a specified position of the list.
Retrieve an entry at a specified position of the list.
Remove an entry from a specified position in the list.
Return a pointer to a node that contains the first occurrence of a specified item.
Destructor
Write a main function to test all the previous functions.
Write a function that permits to replace the contents of the node that contains a specified item with a given item.
Write a function that counts the number of occurrence for a specified item.
We need to create a linked list class (called linklist )
The individual data items, or links, are represented by structures of type link. Each structure contains an integer- representing the object’s single data item and a pointer to the next link.
The list itself stores a pointer to the link at the head of the list.
The class should contain functions that do the following:
Construct the list, leaving it empty.
Overload the constructor that permits to make the first node with a given data.
Determine whether the list is empty or not.
Find the size of the list.
Insert an entry at a specified position of the list.
Retrieve an entry at a specified position of the list.
Remove an entry from a specified position in the list.
Return a pointer to a node that contains the first occurrence of a specified item.
Destructor
Write a main function to test all the previous functions.
Write a function that permits to replace the contents of the node that contains a specified item with a given item.
Write a function that counts the number of occurrence for a specified item.