  The geometric intersection number of a curve on a surface is the minimal
number of self-intersections of any homotopic curve, i.e. of any curve obtained
by continuous deformation. Given a curve $c$ represented by a closed walk of
length at most $\ell$ on a combinatorial surface of complexity $n$ we describe
simple algorithms to (1) compute the geometric intersection number of $c$ in
$O(n+ \ell^2)$ time, (2) construct a curve homotopic to $c$ that realizes this
geometric intersection number in $O(n+\ell^4)$ time, (3) decide if the
geometric intersection number of $c$ is zero, i.e. if $c$ is homotopic to a
simple curve, in $O(n+\ell\log\ell)$ time. The algorithms for (2) and (3) are
restricted to orientable surfaces, but the algorithm for (1) is also valid on
non-orientable surfaces.
  To our knowledge, no exact complexity analysis had yet appeared on those
problems. An optimistic analysis of the complexity of the published algorithms
for problems (1) and (3) gives at best a $O(n+g^2\ell^2)$ time complexity on a
genus $g$ surface without boundary. No polynomial time algorithm was known for
problem (2) for surfaces without boundary. Interestingly, our solution to
problem (3) provides a quasi-linear algorithm to a problem raised by Poincar\'e
more than a century ago. Finally, we note that our algorithm for problem (1)
extends to computing the geometric intersection number of two curves of length
at most $\ell$ in $O(n+ \ell^2)$ time.
