Implement the unsorted single linked list as we did in the class and implement the following operations: 1.DeletelastDuplicat(): For any element in the linked list, if there are multiple copies (> = 2 copies), delete the last copy. DeleteSecondlastDuplicat(): For any element in the linked list, if there are multiple copies (> = 2 copies), delete the second last copy Test your program with the following operations: a)insert 5 b)Insert 7 c)Insert 11 d)Insert 5 e)Insert f) Insert 5 g) Print out the list h) Delete the last duplicate of 5 i)Print out the list i) Delete the last duplicate of 11 k) Print out the list I) Insert 11 m) Insert 7 n) Print out the list O) Delete the second last duplicate of 5 p) Print out the list q) Delete the second last duplicate of 7 r) Print out the list Solution #include #include #include using namespace std; struct node { int data; struct node *next; }*start; class LinkedList { public: node* create_node(int); void insert_begin(); void insert_pos(); void insert_last(); void delete_pos(int); void delete_lastdup(); void delete_seclast(); int search(int); void display(); int get_count(int); LinkedList() { start = NULL; } }; int main() { int choice, pos, value, res=0; LinkedList sl; start = NULL; while (1) { cout<>choice; switch(choice) { case 1: cout<<\"Inserting Node at Beginning: \"<>pos; sl.delete_pos(pos); break; case 5: cout<<\"Search element in Link List: \"<>value; res=sl.search(value); cout<<\"Element \"<data = value; temp->next = NULL; return temp; } } //function to insert element at beginning void LinkedList::insert_begin() { int value; cout<<\"Enter the value to be inserted: \"; cin>>value; struct node *temp, *p; temp = create_node(value); if (start == NULL) { start = temp; start->next = NULL; } else { p = start; start = temp; start->next = p; } cout<<\"Element Inserted at beginning\"<next != NULL) { if(s->data == value) count++; s = s->next; } return count; } //function to insert node at last void LinkedList::insert_last() { int value; cout<<\"Enter the value to be inserted: \"; cin>>value; struct node *temp, *s; temp = create_node(value); s = start; while (s->next != NULL) { s = s->next; } temp->next = NULL; s->next = temp; cout<<\"Element Inserted at last\"<>value; struct node *temp, *s, *ptr; temp = create_node(value); cout<<\"Enter the postion at which node to be inserted: \"; cin>>pos; int i; s = start; while (s != NULL) { s = s->next; counter++; } if (pos == 1) { if (start == NULL) { start = temp; start->next = NULL; } else { ptr = start; start = temp; start->next = ptr; } } else if (pos > 1 && pos <= counter) { s = start; for (i = 1; i < pos; i++) { ptr = s; s = s->next; } ptr->next = temp; temp->next = s; } else { cout<<\"Positon out of range\"<>value; c=get_count(value); if(c<2) { cout<<\"duplicate does not exist\"<>value; c=get_count(value); x=c-1; if(c<2) { cout<<\"duplicate does not exist\"<data == value) { f++; res=pos; if(f==x) break; } s = s->next; } delete_pos(res); } } //delete element at p.