okay, so i do not understand the building of a link list although my professor has explained during my tutorial before. I cant get the concept of insertion a node and deletion of a node. i tried building a linked list myself which is mostly memorised from books. therefore can u please kindly explain to me the steps on how to build a linked list and insertion of a node. This is my linked list code
class nodetype
{
public:
int data;
public:
nodetype *link;
nodetype();
~nodetype();
};
class list
{
nodetype *head;
nodetype *last;
nodetype *current;
nodetype *pointer;
public:
add();
delete();
traverse();
};
nodetype::nodetype()
{
data = 0;
link = 0;
}
nodetype::~nodetype()
{
data = 0;
link = 0;
}
list::add(nodetype *newnode)
{
if (head == NULL)
{
head = last = newnode;
nodetype = new newnode
}
else
newnode->link;
}
list::traverse()
{
current = head;
while (current != NULL)
{
current = current -> link;
}
}
list::delete()
{
current -> link = p -> link -> link;
pointer = current -> link;
current -> link = q -> link;
delete pointer;
}