JFE301Xuất hiện trong 1 đề thi
View the picture and choose the right answer. \nAs shown in the figure below, there is a binary tree created according to the specific rule that the value of a parent node is greater than that of a child element. \nmermaid\ngraph TD N15[15] --> N11[11] N15 --> N13[13] N11 --> A[3<br/>A] N11 --> N8[8] N8 --> B[7<br/>B] N13 --> N9[9] N13 --> D[4<br/>D] N9 --> C[2<br/>C] N9 --> N1[1] \nWhen a new element with the value $12$ is inserted in the places marked by $A$, $B$, $C$, or $D$ in the tree according to the steps defined below, where should it be inserted in order to maintain the specific rule and minimize the number of exchanges? [Steps] 1. Add the element to a leaf node of the tree. 2. Compare the added element with its parent; if the result is in the correct order, stop. If not, go to Step 3. 3. Exchange the element for its parent and return to Step 2.
Các lựa chọn
AChoose b
BChoose a
CChoose d
DChoose c