You need to write a function to find the minimum element in the list. I set the list in the following way:
template <typename T> class list { struct node { T data; node *next; node *prev; }; node *head; node *tail; ... }
I wrote a function that seems to be compiled without errors, but does not display any result. I can not figure out where the error is.
template <typename T> int list<T> :: seek_min() { node *temp = head; int min = temp -> data; for (temp; temp != NULL; temp = temp->next) { if (temp->data < min) { min = temp -> data; temp = temp -> next; } } return min; }