IMPLMENTED IN C 1. Implement a doubly linked list and the following methods: a.
ID: 3765828 • Letter: I
Question
IMPLMENTED IN C
1. Implement a doubly linked list and the following methods:
a. Insert
b. Delete
c. Add first
d. Add last
e. Get
f. Deep copy
g. Size
The main should allow the user to enter three values to insert, a position to delete, a value to add to the beginning of the list, a value to add to the list, a position to get, and your program should print the resulting list after each input. Finally, the main should print the size of the final list and then make a copy printing out the name, pointer location, and memory location of each list.
Explanation / Answer
Implement a doubly linked list to get deep copy and size
The allocated memory in double linked list for a newnode is called dynamically allocate memory and loads the given data in it.
syntax :
struct node * nodeCreation(int data)
{
struct node *newnode;
newnode = (struct node *)malloc(sizeof (struct node));
newnode->data = data;
newnode->next = NULL;
newnode->prev = NULL;
return (newnode);
}