Here is the question, with an example of the tests it’s supposedto pass.
// list: ptr to a linked list of Node (each with int data, and Node next) // Return the largest value in the list /This value may be unique, or may occur more than once 7 You may assume 1ist has at least one element int largestValue ( Linked List *list) { Code may assume that these assertions are true; so does not need to do error checking for these conditions. assert(list!=NULL); assert(list->head != NULL); /TODO: Insert code here to calculate and return largest value in list (which may not be unique) Replace this line with correct code return -42; // STUB! —LARGEST_VALUE– FAILED: largestValue (list1) Expected: 73 Actual: -42 FAILED: largestValue (list2) Expected: -4 Actual: -42 FAILED: largestValue (list3) Expected: 4 Actual: -42 FAILED: largestValue (list4) Expected: 3 Actual: -42 Show transcribed image text // list: ptr to a linked list of Node (each with int data, and Node next) // Return the largest value in the list /This value may be unique, or may occur more than once 7 You may assume 1ist has at least one element int largestValue ( Linked List *list) { Code may assume that these assertions are true; so does not need to do error checking for these conditions. assert(list!=NULL); assert(list->head != NULL); /TODO: Insert code here to calculate and return largest value in list (which may not be unique) Replace this line with correct code return -42; // STUB!
—LARGEST_VALUE– FAILED: largestValue (list1) Expected: 73 Actual: -42 FAILED: largestValue (list2) Expected: -4 Actual: -42 FAILED: largestValue (list3) Expected: 4 Actual: -42 FAILED: largestValue (list4) Expected: 3 Actual: -42
Expert Answer
Answer to Here is the question, with an example of the tests it’s supposed to pass….