class LLint { protected: struct link ... as before link * first, * last; public: LLint() { first = NULL; last = NULL; } void add_to_front(int newval) { if (first == NULL) { first = new link(newval, NULL); last = first; } else first = new link(newval, first); } void add_to_end(int newval) { if (first == NULL) { first = new link(newval, NULL); last = first; } else { link * newlink = new link(newval, NULL); last->next = newlink; last = newlink; } }; int remove_front() { assert(first != NULL); OR if (first == NULL) { cerr << "remove from empty list\n"); exit(1); } int val = first->data; link * old = first; first = first->next; delete old; if (first == NULL) last = NULL; return val; } ----------------------------------- void selection_sort() { link * begin = first; while (begin != NULL) { link * smallest = begin; link * ptr = begin->next; while (ptr != NULL) { if (ptr->data < smallest->data) smallest = ptr; ptr = ptr->next; } swap(begin->data, smallest->data); begin = begin->next; } }