That's an interesting way of thinking. Since it's always the space at the end of the hangar that's “extra,” we only need to consider aircraft placement at the hangar's end.
Or try imagining this: maybe we could place the horizontally parked aircraft in the middle of the hangar, after all, there's no rule saying the existing aircraft absolutely cannot change positions?
To help you visualize, here's a photo of the hangar deck on a Nimitz carrier. As you can see, the aircraft are not all oriented in the same direction
View attachment 166456