Engineering
Chemistry
Rearrangement of carbocation
Question

Find out the number of 1-2- shifts during the conversion of

2

3

4

5

JEE Advance
College PredictorLive

Know your College Admission Chances Based on your Rank/Percentile, Category and Home State.

Get your JEE Main Personalised Report with Top Predicted Colleges in JoSA

Solution

This question involves counting 1-2-shifts during heap conversion. A 1-2-shift occurs when a node is compared with its children and swapped with the larger child (if needed) to maintain the max-heap property. The given array is: 2, 12, 16, 5, 1, 8, 7, 4, 3.

To build a max-heap, we start from the last non-leaf node and heapify each node. The 1-2-shifts are the individual downward swaps. For node 5 (value 5), it swaps with its larger child (8), which is one shift. Then, for node 16 (value 16), no swap is needed. For node 12 (value 12), it swaps with its larger child (16), which is one shift. For the root node 2 (value 2), it swaps with 16 (first shift), then with 8 (second shift), and finally with 5 (third shift).

Total 1-2-shifts: 1 (for node 5) + 1 (for node 12) + 3 (for root) = 5.

Final Answer: 5