  Dirac's theorem (1952) is a classical result of graph theory, stating that an
$n$-vertex graph ($n \geq 3$) is Hamiltonian if every vertex has degree at
least $n/2$. Both the value $n/2$ and the requirement for every vertex to have
high degree are necessary for the theorem to hold.
  In this work we give efficient algorithms for determining Hamiltonicity when
either of the two conditions are relaxed. More precisely, we show that the
Hamiltonian cycle problem can be solved in time $c^k \cdot n^{O(1)}$, for some
fixed constant $c$, if at least $n-k$ vertices have degree at least $n/2$, or
if all vertices have degree at least $n/2-k$. The running time is, in both
cases, asymptotically optimal, under the exponential-time hypothesis (ETH).
  The results extend the range of tractability of the Hamiltonian cycle
problem, showing that it is fixed-parameter tractable when parameterized below
a natural bound. In addition, for the first parameterization we show that a
kernel with $O(k)$ vertices can be found in polynomial time.
