Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
570 B
3
Indexable
Never
void findMinValue(LinkedList list) {

    Element element;
    Element min;

    LINKEDLIST_goToHead(list);

    if(LINKEDLIST_isEmpty(list)) {
        printf("The list is empty.\n");
    }else {

        min = LINKEDLIST_get(list);

        LINKEDLIST_next(list);
        element = LINKEDLIST_get(list);

        while(!LINKEDLIST_isAtEnd(list)) {

            if(element < min) {
                min = element;
            }

            LINKEDLIST_next(list);
            element = LINKEDLIST_get(list);
        }

        printf("Min value is: %d\n", min);

    }

}