I've been working on a Linked List assignment. I completed it but I still have a problem on deleting an element that has a predecessor or after an element and inserting an element after an element...can anyone give me an idea?
This is what I have so far
#include <iostream>
using namespace std;
struct Node{
int x, y;
Node *next;
};
Node *start_ptr = NULL;
void traversal()
{
Node *temp;
temp = new Node;
temp = start_ptr;
while (temp != NULL)
{
temp = temp -> next;
}
}
void delete_start__node()
{
Node *temp;
temp = start_ptr;
start_ptr = start_ptr -> next;
delete temp;
}
void insert_at_Beginning()
{
Node *newptr;
newptr = new Node;
newptr -> next = start_ptr;
start_ptr = newptr;
}