Mr Siddharth is correct in the formation of the trains he has mentioned.
In other trains, the AC coaches are third/fourth in the formation normally because they act as a buffer between the SLR/Unreserved coaches. There is some mention of the fact that by coupling the AC coaches in such a fashion, reduces noise in the AC coaches, (which would be high due to proximity to diesel engines), and also to provide proper platform area when it arrives at stations.
As you would have all noticed during your travels, near the...
more... engine, and at the rear, on the platform where the trains arrive, it is overcrowded with parcels, luggage and other items to be loaded into the luggage compartments, either in the present train, or waiting for other trains. Also the goods are offloaded and kept there for quite some time.
That's the reason why NORMALLY SL and AC coaches come between the SLR/UR coaches at both ends. As for the inconvenience to the Unreserved passengers, there is the buffer of the SLR and the luggage van/coach.
Good wishes.