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--; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started