linked_list/linked_list1.cpp
// to find max value in a linked list
to find max value in a linked list
to find max value in a linked list
int max_node(struct Node *p)
{
    int max = p->data;
    while(p)
    {
        if (p->data > max)
        {
            max = p->data;
        }
        p = p->next;
    }
    return max;
}
int max_node ( struct Node * p ) { int max = p -> data ; while ( p ) { if ( p -> data > max ) { max = p -> data ; } p = p -> next ; } return max ; }
to find max value in a linked list
to find max value in a linked list
// init first as max // till p becomes NULL // if next data is greater than the max value // simply update the max vaue with the greater value // move p to next of p // return max value