Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose we have a List class with private data dataArray (an array holding the l

ID: 3553355 • Letter: S

Question

  1. Suppose we have a List class with private data dataArray (an array holding the list items) and length (a variable indicating the current list length). Additionally, you can assume that "!=" is defined appropriately for ItemType. What does the following function do?
     void List::Mystery( ItemType alpha, bool& result ){   int index = 0;   while (index < length && alpha != dataArray[index]){     index++;   }   result = (index < length); }  
 void List::Mystery( ItemType alpha, bool& result ){   int index = 0;   while (index < length && alpha != dataArray[index]){     index++;   }   result = (index < length); }  

Explanation / Answer

FIRST CORRECT ANSWER :