Question: IN C PROGRAMMING. how do i re-implement this using dummy nodes?? doing something with the listed below before the code typedef struct nodestruct { Key

IN C PROGRAMMING.

how do i re-implement this using dummy nodes??

doing something with the listed below before the code

typedef struct nodestruct {

Key item;

struct nodestruct *next; }

Node;

typedef struct {

int size; // Number of items on users list

Node *head, *tail;

} List;

typedef struct linkedlist {

Node *head, *tail;

} List;

below is the code i already have

#include #include

struct Node { int data; struct Node *next; };

struct Node *empty_list(){ struct Node* new_node = (struct Node*) malloc(sizeof(struct Node)); return new_node; }

int size(struct Node *head) {

int count = 0; while(head != NULL) { count++; head = head->next; }

return count; }

int kthItem(struct Node *head, int k) {

int N = size(head);

if(N < k) { printf("Less number of node "); return 0; }

int i = 0; while(i < k) { head = head->next; }

return head->data; }

int checkItem(struct Node *head, int item) {

while(head != NULL){

if(head->data == item) return 1; }

return 0; }

void deleteList(struct Node **head) {

struct Node *t = NULL; struct Node *temp = *head;

while(temp != NULL) { t = temp; temp = temp->next; free(t); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!