void LinkedListInsert(ptrType& HeadPtr, itemType NewItem, bool& Success) { if ((HeadPtr == NULL) || (NewItem < HeadPtr->Item)) { // base case: insert NewItem at beginning // of the linked list to which HeadPtr points ptrType NewPtr = new node; Success = bool(NewPtr != NULL); if (Success) { NewPtr->Item = NewItem; NewPtr->Next = HeadPtr; HeadPtr = NewPtr; } // end if } else LinkedListInsert(HeadPtr->Next, NewItem, Success); } // end LinkedListInsert