It is a fairly prevalent view now that European colonial Empires saw the beginning of their end come after WW1, though obviously they were to actually grow larger in the post war settlement. I also want to say that Empires were large and complicated entities and I would not claim to know the exact reasons why they fell apart everywhere.
The Middle East: This was one of the few areas where Europeans expanded their influence following WW1. Both Britain and France had viewed this area as one they wanted to take over from the late 19th century, neither thought that the decaying Ottoman Empire could maintain these territories against possible Russian expansion and the French wanted land to make up for the dual shames of the Franco Prussian War and the Fashoda Incident.
In 1915 Britain and France created the Sykes Picot agreement which divided the Levant between them on a line on a map between the E in Acre and the last K in Kirkuk. This was made public by the Bolsheviks after the Russian Revolution and attracted criticism from the USA and the Arabs fighting alongside the British in the region.
The Americans were of the opinion that European Imperialism had been at least partly responsible for the War and attempted to have the land placed under international administration. The British and French agreed to have a group of international observers travel around their new mandates to see what the native population would prefer. Both the British and the French then did all in their power to convince this commission that the other was not wanted in the Middle East while they were.
Ultimately the land was partitioned between the British and French as per the Sykes Picot agreement but both sides were left feeling the other had acted in bad faith. They found numerous allies in the Arab population of both countries mandates and both began to fund resistance movements against the other power.
During WW2 the French in the Middle East sided with the Vichy government and were invaded by the British, despite fighting back they were defeated and the states of Lebanon and Syria were created, this was the end of the French mandate. After WW2 Britain was faced with the same problem they'd been confronted by following WW1, that they were governing a population that didn't want them, the USA was preaching decolonization and they lacked the funds to maintain a military presence in the Middle East. In these circumstances they could not maintain their Empire.
Algeria: Algeria is a fairly different case as they had been colonised by the French for a much longer period of time and contained a large population of French origin 'pied noirs' (though I should note that by 1917 only 1 in 5 pied noirs was of French Origin, the rest from other parts of Europe, also for clarity I will not refer to pied noirs as Algerian or French in order to avoid confusion)
During WW1 Algerian troops served with distinction in the French Army losing 25,000 killed out of 173,000 who served. This led to a movement in mainland France to offer Muslim Algerians a path to French citizenship, the Pied Noirs simply said no, they would not consent to any measure that improved the standing of the Algerians. This created resentment amongst the Algerian population who felt that their sacrifices in WW1 had made up for the French education and system of government that they had been given.
There was a fundamental split between the Algerian population, who wanted equality with the Pied Noirs within Algeria and the French in France and the Pied Noirs, who wanted to prevent equal rights for Algerians as it would threaten their position of minority rule.
A major factor in the collapse of French rule was the growth of Nationalist movements in Algeria. It was the founding of the Ulema in 1931 that probably marks their beginning, they were originally a deeply religious organisation who ultimately failed in their goals but did a lot to foster a sense of Algerian identity separate from the French education system forced upon Algeria.
The two most important groups of nationalists were the Liberals and the Revolutionaries. They initially had fundamentally different goals, the Liberals wanted equality with the French while the Nationalists wanted a nation for themselves.
Prior to WW2 many liberals slowly became disillusioned with their cause as reform bill after reform bill was killed by the powerful Pied Noir lobbies, this led them to move away from assimilation towards independence.
WW2 itself was incredibly significant in the end of French rule in Algeria, the French were soundly defeated in 1940, French Algeria also sided with Vichy France and in 1942 was invaded by the Allies, surrendering almost immediately, this had a profound affect on the Algerian population who no longer saw France as an all powerful country but instead as relatively weak compared to the Germans, British and Americans.
Once again Algerians were called up to fight for the French (this time the Free French under De Gaulle). This time they immediately presented the French General with a list of reforms, he said he wanted soldiers first and nothing else mattered. While serving in the French Army many Algerians were profoundly influenced by the way that Europeans were treated so much better than them and the way they destroyed Europe so willingly.
In 1944 De Gaulle said that French colonial policy was to move colonies towards majority rule and equal citizenship, this was almost universally rejected, it was seen as nowhere near enough.
French rule in Algeria continued until 1962 but one event in 1945 and be seen as the 'end of the beginning'. There was a march of Algerians in Setif, many returning from the War. Exactly how it became violent we will never know for certain but rioters exchanged fire with police before heading out into the countryside in search of Pied Noirs whom they mutilated and killed in their hundreds. The Armies response was incredibly violent, somewhere between 1500 and 45,000 Algerians were killed (6000 is the normally used figure now). To a huge number of Algerians this was the end of French legitimacy, they were no longer educators or civilisers but oppressors.
As I mentioned above the French were to fight a war to attempt to keep Algeria from 1954 to 62 but they were unable to overcome the tide of resistance from Algerians that began following WW1 and was exacerbated by WW2.
Sources: Finest Years, Max Hastings
A Savage War of Peace, Alistair Horne
A Line in the Sand, James Barr
The Price of Glory, Alistair Horne