As we know that the, stability of carbocation can be decided by many effects, like inductive effect, resonance, hyperconjugation etc. And a combined effect leads to the following order of stability of carbocation:
As structure A is having a carbocation, which is primary and allylic carbocation, whereas the carbocation in the structure B has secondary and allylic carbocation.
Hence, structure B is more stable.
(NOTE: As in both cases the allylic carbocation is common, it will not be the deciding factor for stability, hence we will decide the stability by primary and secondary carbocation.
Rate this question :