Page 1 of 1

Assume: class SNode { friend class SLL; int data; string c; // as opposed to int data; SNode *next; }; Given the followi

Posted: Tue Jul 12, 2022 8:11 am
by answerhappygod
Assume Class Snode Friend Class Sll Int Data String C As Opposed To Int Data Snode Next Given The Followi 1
Assume Class Snode Friend Class Sll Int Data String C As Opposed To Int Data Snode Next Given The Followi 1 (97.85 KiB) Viewed 18 times
Assume: class SNode { friend class SLL; int data; string c; // as opposed to int data; SNode *next; }; Given the following list: op->bi->tr->s->a->ho->pec If you run the following function, then print out the linked list, what do you get? void SLL::MakeIt() { } last->next = first; SNode *tmp = first; int ct = 0; int s2 = 0; SNode *tmp2; while (size > 0) { if (ct == 2) { if (s2 == 0) { } last = tmp2; Answer: } else { first = tmp->next; tmp->next = tmp->next->next; first->next = NULL; tmp2= first; tmp2->next = tmp->next; tmp->next = tmp->next->next; tmp2->next->next = NULL; tmp2 = tmp2->next; } s2++; ct = 0; size--; } ct++; tmp = tmp->next;