Jupiter is large enough to alter the orbit of a comet if it ventures too near. This most likely happened to Halley's Comet several thousand years ago. As a result, it now takes only 76 years to orbit the Sun. Comets that return in less than 200 years are called short period comets. This is not a simple task, since comets, like all orbiting bodies, move faster as they get closer to the Sun.
Comets have extremely exaggerated orbits.
Whereas the planets have relatively circular orbits, the orbit of a comet, is markedly oblong or elliptical. The Sun's tremendous size and mass, in effect, reels in the comet and then slings it back to whence it came. On each passage around the Sun a comet uses-ups some of its matter. So, with every successive visit they lose some of their pizazz, and eventually they won't reappear. However, if you recall from an earlier science question, we can still see their final gasps for glory when the Earth passes through their orbit and we are treated to a shower of meteors.