Assignment 1 Singly Linked list by Jeetansh Arora
Assignment 1 Singly Linked list by Jeetansh Arora
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
};
newNode->data = data;
newNode->next = NULL;
return newNode;
if (*head == NULL) {
*head = newNode;
return;
temp->next = newNode;
temp = temp->next;
return 0;
appendNode(&result, temp->data);
temp = temp->next;
temp = head2;
if (!isPresent(result, temp->data)) {
appendNode(&result, temp->data);
temp = temp->next;
return result;
}
2. Form a list containing the INTERSECTION of the elements of
two lists (singly linked list).
struct DNode {
int data;
struct DNode* next;
struct DNode* prev;
};
temp = head2;
while (temp->next != head2) {
temp = temp->next;
}
temp->next = head1;
return head1;
}
struct PolyNode {
int coeff;
int x;
int y;
int z;
struct PolyNode* next;
};