Source of insertSorted.cpp


  1: //  Created by Frank M. Carrano and Timothy M. Henry.
  2: //  Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.

  4: template<class ItemType>
  5: bool SortedListIsA<ItemType>::insertSorted(const ItemType& newEntry)
  6: {
  7:    int newPosition = std::abs(getPosition(newEntry));
  8:    // We need to call the LinkedList version of insert, since the
  9:    // SortedListIsA version does nothing but return false
 10:    return LinkedList<ItemType>::insert(newPosition, newEntry);
 11: }  // end insertSorted