Lab 4

where_this_goes:

Implement the where_this_goes function as follows:

 

template <typename ITEM_TYPE>
node<ITEM_TYPE>* WhereThisGoes(node<ITEM_TYPE>* head,         //node after which this
                               ITEM_TYPE item,                //    item belongs
                               bool ascending=true);          //order: 0 ascending

 

Assuming a sorted list (order of the list is determined by the ascending argument) return a pointer to the node in the linked list after which this item belongs.

Return a nullptr if this item belongs at the start of the list.