Question: Read the following code segment carefully and fill in blank #2. Read the documentation in the Pre/Post conditions carefully. void SortedType::DeleteItem(ListItemType& item) // Pre: List

Read the following code segment carefully and fill in blank #2.

Read the documentation in the Pre/Post conditions carefully.

void SortedType::DeleteItem(ListItemType& item)

// Pre: List contains valid data and List is sorted by key using

// function ComparedTo.

// There is at most one list item with the same key as item;

// there may be none.

// Post: No list element has the same key as item.

// List is still sorted.

{

int location = 0;

int index;

bool moreToSearch;

moreToSearch = ______________; // 1

bool found = false;

while ( !found && _____________) // 2

{

switch (item.ComparedTo(info[location]))

{

case LESS : location++

moreToSearch = ______________________; // 3

break;

case GREATER : moreToSearch = ___________________; // 4

break;

case EQUAL : ________ = true // 5

break;

}

}

if (found)

{

for (index = location + 1; index < length; index++)

info[index - 1] = ______________; // 6

length--;

}

A) moreToSearch

B) !moreToSearch

C) None of these answers is correct.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!