Question: Q8. Given is the following variant of member function insert of class Node :: insert (TSX) if (x value or x newchild new Node (x,

 Q8. Given is the following variant of member function insert of

Q8. Given is the following variant of member function insert of class Node:: insert (TSX) if (x value or x newchild new Node (x, o.o,this) leftChild newchild if { else leftchild->insert (x) elset if (rightChild) Node (x,o, o, this) ; Node * ne child = new rightchild newchild; else rightChild->insert (x) Imagine a set data structure that is rooted in a binary node N3; N3 contains value 3; node N3 has N2 (with value 2) as its left child and node N5 (with value 5) as its right child. Nodes N2 and N5 are leaves. What is the result of function call N3.insert(3)? (a) The set data structure has not changed since it already contained value 3. (b) N3 has left child N2 and right child N5, and N2 has a righ t child with value 3. (c) N3 has left child N2 and right child N5, and N5 has a left child with value 3 (d) Given the above implementation, a new node with value 3 is both the right child of N2 and the left child of N5. Q9: A vector is sorted in descending order with the insertion sort algorithm. After 4 iterations of the outer loop, he vector holds values as shown: 84, 31, 25,7, 2, 3, 5, 12 After the next (outer) iteration, the vector values will be stored as: (a) 84, 31, 25, 12, 2,3,5,7 (b) 84, 31, 25, 3, 12, 7,5, 2 (c) 84, 31, 25, 7, 3, 2,5, 12 (d) 84, 31, 25, 7, 12, 5, 3, 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!