In the Following C++ Program, modify the deleteItem function to it\'s specificat
ID: 3689473 • Letter: I
Question
In the Following C++ Program, modify the deleteItem function to it's specifications below...
SortedType::SortedType (int size):UnsortedType (size)
{
//intentionally empty body
}
//Just call parent's constructor
SortedType::SortedType (const SortedType & other):UnsortedType (other)
{
//intentionally empty body
}
//Modify Here!
void SortedType::DeleteItem(ItemType item)
// Pre: item's key has been initialized.
// An element in the list has a key that matches item's.
// Post: No element in the list has a key that matches item's.
{
//Todo:
}
Explanation / Answer
void SortedType::DeleteItem(ItemType item)
{
int location=0;
while(item.comparedTo(info.[location]) !=EQUAL)
location ++;
for(int index=location+1:index<length:index++)
info[index-1]=info[index];
length--;
}