Los elementos 32, 15, 20, 30, 12, 25, 16 se insertan uno por uno en el orden indicado en un Max Heap. El Max Heap resultante es.
(A) a
(B) b
(C) c
(D) d
Answer: (A)
Explanation:
32, 15, 20, 30, 12, 25, 16 After insertion of 32, 15 and 20 32 / \ 15 20 After insertion of 30 32 / \ 15 20 / 30 Max Heap property is violated, so 30 is swapped with 15 32 / \ 30 20 / 15 After insertion of 12 32 / \ 30 20 / \ 15 12 After insertion of 25 32 / \ 30 20 / \ / 15 12 25 Max Heap property is violated, so 25 is swapped with 20 32 / \ 30 25 / \ / 15 12 20 After insertion of 16 32 / \ 30 25 / \ / \ 15 12 20 16
Publicación traducida automáticamente
Artículo escrito por GeeksforGeeks-1 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA