Menu

[solved]-C C Queu Output 4 9 2 1 6 8 5 3 7 Please Explain Line Line Ive Stuck Hours Thanks God Bles Q39040156

C++ C++ queu

why is the output : -4 9 -2 -1 -6 8 5 -3 -7

please explain line by line ive been stuck on this for hoursthanks god bless

Each element of the child array is either nullptr, denoting an efilßty pointer to a non- empty subtree. Heres a picture of oint fixNegatives (Node p) ( 1 to Vo 9-2 ダ int count = 0; queue<Node*> toDo; toDo.push(p); while ! toDo,empty () { 2 3 4 toD p

Each element of the child array is either nullptr, denoting an efilßty pointer to a non- empty subtree. Here’s a picture of one possible 4-tree: root -4 nullptr -1 -2 nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr 5 -6 nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr -3 -7 nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr int fixNegatives (Node p) ( 1 to Vo 9-2 ダ int count = 0; queue<Node*> toDo; toDo.push(p); while ! toDo,empty () { 2 3 4 toD p= toDo. ffodt () ; toDo.pop(); if (p != nullptr) ( cout << “”<<p->data; // write a number if (p->data < 0) ( 2 10 -1 p->data = 0; 11 8 5 count++; for (int k = k < 4; k++) toDo.push (p->child [k] ); 12 %&5 13 B-3-7 -2 9. 2& -h 14 return count; If this function is called with a pointer to the node whose data value is -4 in the tree shown in Problem 2, what is written by all the executions of the indicated -4 -1 -2 9 5-7-3 8 -6 output statement? Circle the letter of your choice, and if it’s K, write the output F A. -4 -4 -1 5-7 -3 -2 9 8 -6 -4 9 -6 8 -2 -1 5 -3 -7 G -4 9 -2-1 H B -4 9 -2-1 -6 8-3 5 -7 -4 -1 5 -7 C. -4 9 -1 5 -6 8 -2 -3 -7 J. -4 -1 -2 9 D. -4 -1 -2 9 5 8-6 -7 -3 E K. Something else. Write that something else here -6 8t -3 4 9-2 n than three of the numbered lines of the inta is -4 in 567 Show transcribed image text Each element of the child array is either nullptr, denoting an efilßty pointer to a non- empty subtree. Here’s a picture of one possible 4-tree: root -4 nullptr -1 -2 nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr 5 -6 nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr -3 -7 nullptr nullptr nullptr nullptr nullptr nullptr nullptr nullptr
int fixNegatives (Node p) ( 1 to Vo 9-2 ダ int count = 0; queue toDo; toDo.push(p); while ! toDo,empty () { 2 3 4 toD p= toDo. ffodt () ; toDo.pop(); if (p != nullptr) ( cout

Expert Answer


Answer to C++ C++ queu why is the output : -4 9 -2 -1 -6 8 5 -3 -7 please explain line by line ive been stuck on this for hours th… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *