Singly Linked List


Definition
A Singly Linked List is a linked list which can be traversed only in one direction.
Predefined
struct node
{
  int num;
  struct node *link;
};
struct node *head = NULL;

FUNCTIONS
Check
int IsEmpty(struct node *head);
int IsIdentical(struct node *head1, struct node *head2);

Find
int CountNodes(struct node *head);
int Search(struct node *head, int item);
struct node * FindMiddleNode(struct node *head);

Traversal
int Display(struct node *head);
int DisplayReverse(struct node *head);

Modify
int FreeNode(struct node **temp);
int InsertAtFront(struct node **head, int item);
int InsertAtRear(struct node **head, int item);
int InsertAtPosition(struct node **head, int item, int position);
int DeleteAtFront(struct node **head, int *item);
int DeleteAtRear(struct node **head, int *item);
void DeletePosition(struct node *head, int pos);
struct node * Reverse(struct node *head);
void Concat(struct node *head1, struct node *head2);
void FreeList(struct node **head);

Create
struct node * GetNode();
struct node * Copy(struct node *head);