Question discussion

The keys 10, 4, 15, 2, 8, 1 are inserted one by one into an initially empty min-heap (each insertion followed by sift-up). The array repres…

1301Medium DSSSB TGT Computer Science 0 replies 1 views
0

The keys 10, 4, 15, 2, 8, 1 are inserted one by one into an initially empty min-heap (each insertion followed by sift-up). The array representation of the heap is

  • A1 2 4 10 8 15
  • B1 4 2 10 8 15
  • C1 4 2 8 10 15
  • D2 4 1 10 8 15
Correct answer: B

Explanation

Inserting 2 sifts it above 10 and 4; inserting 1 sifts it above 15 and 2 to the root, leaving [1, 4, 2, 10, 8, 15].

Discussion 0

Nobody has replied yet. Start the discussion!