The layouts
documentation (section 6.2 Detailed float layout, p 25) describes the possible lengths influencing the vertical space between floats and text body elements:
\textfloatsep
- between t
op and b
ottom-aligned float and text body (default is 20\p@ \@plus 2\p@ \@minus 4\p@
); and
\intextsep
- between float and text for other floats (default is 12\p@ \@plus 2\p@ \@minus 2\p@
).
The defaults for these are set in latex.ltx
. Both these lengths have glue (meaning they can stretch/shrink). Here's a graphic from layouts
showing the lengths involved.

Here's an incidental view on a change in \textfloatsep
from the default to 0pt
with an example from the algorithmicx
package:

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\begin{document}
\lipsum[1-2]
\begin{algorithm}[t]
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile\label{euclidendwhile}
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\caption{Euclid’s algorithm}\label{euclid}
\end{algorithm}
\lipsum[3-6]
\setlength{\textfloatsep}{0pt}% Remove \textfloatsep
\begin{algorithm}[t]
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile\label{euclidendwhile}
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\caption{Euclid’s algorithm}\label{euclid}
\end{algorithm}
\end{document}
Note the visible difference in the vertical space below algorithm.