Question
(WRITE PROGRAM IN C LANGUAGE) In class, we have studied the singly linked list, implemented as follows: #include #include typedef struct node { int data
(WRITE PROGRAM IN C LANGUAGE) In class, we have studied the singly linked list, implemented as follows:
#include #include
typedef struct node { int data ; struct node * next ; } node t ;
typedef struct { node t * head ; node t * t a i l ; } LL t ;
LL t * LLcreate ( ) { LL t * r e t = malloc ( sizeof ( LL t ) ) ; r e t ->head = NULL; r e t ->t a i l = NULL; return r e t ; }
void LLappend ( LL t * i n t l i s t , int value ) f node t * newNode = mal loc ( s izeof ( node t ) ) ; newNode->data = value ; newNode->next = NULL;
i f ( i n t l i s t ->head == NULL) f i n t l i s t ->head = newNode ; i n t l i s t ->t a i l = newNode ; } else { i n t l i s t ->t a i l ->next = newNode ; i n t l i s t ->t a i l = newNode ; } }
Part a) Implement a function \LLMax" to return the biggest number in the linked list. For example, if a linked list has the elements f5, 100, -100, 2019g, the function LLMax should return 2019. The function prototype is given below.
// Returns the b i g g e s t number in the LL t int LLMax( LL t * i n t l i s t ) f }
Part b) Implement a function \LLDelete" which removes a target number if it is found in the linked list, and displays \Value not found" if the target number is not found. The function prototype is given below.
// De l e t e s the node containing the t a r g e t int e g e r , and // warns user i f the t a r g e t i s not found void LLDelete ( LL t * i n t l i s t , int t a r g e t ) { }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started