The question whether aviation should be exclusively in an air force, partially in navy/army or all in navy/army is a tricky one.
I reasoned that the supplier-customer relationship in the force structure is the key question for several years.
Aviation supports both naval and ground forces. The most obvious example is CAS (close air support); aircraft providing fire support to ground troops, not completely unlike artillery. Reconnaissance and logistical aviation are in similar support roles.
The USAF has the A-10 aircraft for CAS, and a long history of neglect (in comparison to its great affection with fighters and their pilots) has lead many in the U.S. Army to believe that the USAF prefers to be its own customer (air superiority, long-range attacks far away from battlefields) than to be a mere supplier for its customer, the Army. The USAF did indeed focus on CAS only during wars, while it invested heavily in more 'sexy' (prestigious) fighters (and in the 50's: nuclear bombers) than in CAS assets.
Part of the reaction was that the Army produced and emphasized a new aviation branch (after having lost the (United States Army) Air Force when that one became independent); helicopter army aviation and drone projects.
The relationship between infantry and artillery is similar; the infantry keeps its mortars as a hedge for the unreliable artillery that at times prefers to prepare for counter-artillery fires over hazardous close support fires.
- - - - -
The interpretation of the problem as a supplier-customer optimization problem has its difficulties, though. This point of view would assume that independent air forces neglect CAS and prefer so-called 'strategic' attacks while army-integrated air forces would be expected to focus on supporting the army.
The historical record trashes such a hypothesis. (That's too bad, for it was a really nice hypothesis.)
The independent German air force of 1935-1945 focused on 'operational' air support (supporting the operational plan of the army) and neglected so-called 'strategic' attacks (attacks on industry & cities) as much as was possible under the circumstances. This could be excused with several facts if it was the only exception tot he rule: The Luftwaffe was built by former army officers, influenced by WWI pilots who knew only air war over battlefields, had most enemy industrial centres well in range of medium bombers and resource constraints didn't allow for a 'strategic' bomber fleet anyway.
It wasn't the only exception, though: The Imperial Japanese Army Air Force had both CAS aircraft and long-range bombers (although the latter were also used in for some kind of 'strategic' interdiction and for missions in support of ground forces).
The U.S.A.A.F. (United States Army Air Force) was very much focused on 'strategic' bombing well into WW2 despite being part of the U.S.Army.
The independent WW2 Red Air Force of the Soviet Union (VVS,) did focus almost entirely on air attacks in divisional areas (very close to the front) as an independent air force. The Red Air Force had many long-ranged bombers in WW2 and used them almost entirely with a bomb overload (additional bombs, but minimal fuel) on very short range attacks. Its passing interest in long-range aviation was probably entirely dependent on the general Soviet Union's interest in long-range aircraft for civilian purposes.
- - - - -
Military history is less paradox in regard to the support of navies by independent air forces. The almost dismal naval performance of the Luftwaffe in WW2, the poor support of the Italian Navy by the Italian Air Force in WW2, the troubles of the late Italian Navy with equipping its Giuseppe Garibaldi aircraft carrier and the discouraging experience of the Royal Fleet Air Arm in the 30's all seem to confirm that navies need their own aviation branch or else there will be no good air-sea warfare capabilities.
(Hint: The German Navy lost its Tornado IDS wing to the Luftwaffe a few years ago. *Sigh*)
The Israel Air Force (IAF) may be a positive example. It did both the tactical/operational air support just fine in 1967 and 1973, was very capable in the rather 'strategic' Entebbe (1976)and Osirak (1981) raids and proved its 'operational' level capability again over the Beqaa valley (1982). Its later employments were rather mixed, in part because of inappropriate expectations.
Well, what's the optimum?
In regard to navies, the historical record seem to confirm that navies should have their own, unrestricted aviation arm.
A possible exception might apply to very maritime countries where an independent air force would not be distracted from air/sea warfare.
In regard to armies, the historical record seems to suggest a "It depends." answer. It depends on the national needs, on the circumstances and on the available technology.
A possible exception would apply to very small militaries. I doubt that it makes sense to separate air force and army in a military of less than about 100,000 total personnel. A separate air force in such a small military would likely be inefficient because of avoidable bureaucratic overhead.