# Algorithm not displayed under correct section

I'm using the algorithm2e package to put algorithm in my LaTeX documents.

In my document, I have something like this :

\section My algorithms
\subsection Algo 1
code for first algorithm
...

\subsection Algo 2
code for second algorithm
...

\subsection Algo 3
code for third algorithm
...

\subsection Algo 4
code for fourth algorithm
...

and so on.

The problem is that when producing the PDF, some algorithm are correctly displayed under their subsection, and some are displayed on other pages, not under the right section.

I get something like this :

1. My algorithms
1.1 Algo 1
pseudo code for algo 1

1.2 Algo 2
pseudo code for algo 2

1.3 Algo 3
1.4 Algo 4
---------------- next page -----------
pseudo code for algo 3
---------------- next page -----------
pseudo code for algo 4

Here is the full LaTeX source code : http://www.filedropper.com/demo_1 Here is the PDF I get : http://www.filedropper.com/demo_2

Is there a way to make sure the algo will stick with its subsection ?

-