why is tertiary carbocation more stable than primary allylic carbocation?
The decreasing order of stablity of carbocations is:

aromatic (tropylium, cyclopropenyl) > benzyl > allyl > tertiary > secondary > primary

Allylic carbocations are resonance stabilized whereas tertiary alkyl groups are stabilized by hyperconjugation (and inductive effect). The hyperconjugation (and inductive effect), in general, is quite weaker than resonance (and hyperconjugation effect). The only exceptions to the previous statement I am aware of are halogens (inductive effect is stronger than resonance).