//slist1.cpp //methods for class SortedList (implemented with function "myfind") #include #include "slist1.h" SortedList::SortedList():List() {} int SortedList::myfind(Type x, Node *&p, Node *&q) { p = firstnode(); q = NULL; while (p != NULL && p->getinfo() < x) { q = p; p = p->getnext(); } if (p == NULL) return 0; if (p->getinfo() == x) return 1; else return 0; } int SortedList::find(Type x) { Node *p, *q; return(myfind(x,p,q)); } void SortedList::insert(Type x) { Node *p, *q; myfind(x, p, q); if (q != NULL) insertafter(x,q); else insertfront(x); }