Linked list
Linked list
First --> [7][ ] --> [23] [ ] -->[ 9] [ ] --> [43] [ ] --> [ 51] [ ?]
I have to write a function recursive that gives the smallest data element back.
Typdef struct node {
unsigned data;
struct node *next;
} node
Can anybody help me?
[308 byte] By [
WatchDoga] at [2007-10-1 17:39:19]

Can you write a recursive defnition in English?
The smallest element of a list is:
the first if it is smaller than the smallest of the rest of the list
otherwise, it is the smallest element of the rest of the list.
Now, what happens if the rest of the list is the empty list?
Figure that out and translate to Java... err C... and you'll be done.