(Solved) : Question Example Tests S Supposed Pass Q42783419 . . .

void addIntToEndoflist(Linkedlist *list, int value) { assert(list !=NULL); // if list is NULL, we can do nothing. Node *p; //------ADD_INT_TO_END_OF_LIST- PASSED: linkedListToString(list) FAILED: linkedListToString(list) Expected: [42]->[57]->[61]->[

Here is the question, with an example of the tests it’s supposedto pass.

void addIntToEndoflist(Linkedlist *list, int value) { assert(list !=NULL); // if list is NULL, we can do nothing. Node *p; // temporary pointer // TODO: 11 (1) Allocate a new node. p will point to it. D = NULL; // THIS IS PLACE-HOLDER LINE OF CODE. DELETE IT AND REPLACE IT. 11 (2) Set p’s data field to the value passed in 11 (3) Set p’s next field to NULL if (list->head == NULL) { 11 (4) Make both head and tail of this list point to p } else { // Add p at the end of the list. 11 (5) The current node at the tail? Make it point to p instead of NULL 11 (6) Make the tail of the list be p now. ——ADD_INT_TO_END_OF_LIST- PASSED: linkedListToString(list) FAILED: linkedListToString(list) Expected: [42]->[57]->[61]->[12]->null Actual: [42]->[57]->[61]->null FAILED: linkedListToString(list) Expected: [42]->[57]->[61]->[12]->[-17)->null Actual: [42]->[57]->[61]->nul PASSED: linkedListToString(empty) FAILED: linkedListToString(empty) Expected: [0]->null Actual: null FAILED: linkedListToString(empty) Expected: [0]-> [19]->null Actual: null Show transcribed image text void addIntToEndoflist(Linkedlist *list, int value) { assert(list !=NULL); // if list is NULL, we can do nothing. Node *p; // temporary pointer // TODO: 11 (1) Allocate a new node. p will point to it. D = NULL; // THIS IS PLACE-HOLDER LINE OF CODE. DELETE IT AND REPLACE IT. 11 (2) Set p’s data field to the value passed in 11 (3) Set p’s next field to NULL if (list->head == NULL) { 11 (4) Make both head and tail of this list point to p } else { // Add p at the end of the list. 11 (5) The current node at the tail? Make it point to p instead of NULL 11 (6) Make the tail of the list be p now.
——ADD_INT_TO_END_OF_LIST- PASSED: linkedListToString(list) FAILED: linkedListToString(list) Expected: [42]->[57]->[61]->[12]->null Actual: [42]->[57]->[61]->null FAILED: linkedListToString(list) Expected: [42]->[57]->[61]->[12]->[-17)->null Actual: [42]->[57]->[61]->nul PASSED: linkedListToString(empty) FAILED: linkedListToString(empty) Expected: [0]->null Actual: null FAILED: linkedListToString(empty) Expected: [0]-> [19]->null Actual: null

Expert Answer


Answer to Here is the question, with an example of the tests it’s supposed to pass….

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us