There is a function for finding the minimum and maximum values. It is necessary to swap the maximum and minimum element in the bidirectional list through the redirection of links.
void Swap(Spis2 **b) { Spis2 *t = *b; Spis2 *max = *b; Spis2 *min = *b; int x; while (t->next != NULL) { if (t->next->info > max->info) { max = t->next; x = 0; } else if (t->next->info < min->info) { min = t->next; x = 1; } else t = t->next; } cout << "max = " << max->info << endl; cout << "min = " << min->info << endl; }