Yes, there is an algorithm.
Oh, you wanted to know what the algorithm is? Here is one, which presents an algorithm but not all the reasoning behind it. For that, and a proof, and the variant where the odd ball must be identified but not the direction of its deviance, read Thomas Pornin's excellent presentation on the same question on Math Stack Exchange (which I used heavily while writing my answer here).
The core idea is that this problem works in threes. Each weighing involves three sets of balls: the left pane, the right pane, and the balls not being weighed. Each weighing has three possible results: lighter, balanced or heavier.
I'll start with the simpler variant where you know that the odd ball out is heavier than the rest (but not as heavy as two normal balls). The general idea is to weigh one third of the balls against another third, determine which set contains the odd ball, and repeat. But there's a big wrinkle: at the beginning, you don't know whether the odd ball is heavier or lighter, so unless the result of the weighing is “equal”, you're left with two possibilities. To compensate for that, we'll put slightly less than 1/3 of the balls on each pane.
Determine the number $w$ such that $(3^{w-1} - 3)/2 \lt N \le (3^w - 3)/2$, i.e. $w = \lceil \log_3(2N+3) \rceil$. This will be the number of required weighings.
In the first stage, weigh $(3^{w-1}-1)/2$ balls against the same number of balls.
- If the outcome is “heavier” or “lighter”, all the left-over balls are standard; apply the second stage to all the balls that were weighed, and put a marking on each of these balls to indicate whether it was on the lighter or heavier side (this will be used to tell whether the odd ball is lighter or heavier).
- If the outcome is “balanced”, then the odd ball is among the left-over balls, and all the weighed balls are standard; apply the third stage to the left-over balls.
In the second stage, we have a pool of standard balls. Set $(3^w-1)/2$ balls apart, and weigh half of the remainder against the other half, using a standard ball to complete the set if the size is odd.
- If the outcome is “balanced”, repeat the second stage with the left-over balls.
- If the outcome is “lighter” or “heavier”, then move on to the third stage (same principle as in the first stage).
In the third stage, all the balls involved have a mark which indicates whether they are part of the heavy group or of the light group. Put $\lceil N/3 \rceil$ balls on each side of the scale, taking care to put the same number of light balls on both sides (and also the same number of heavy balls).
- If the outcome is “balanced”, the odd ball is one that wasn't weighed. Repeat the third stage with the left-over balls.
- If the outcome is “lighter” or “heavier”, then the odd ball is either among the light balls on the lighter side or among the heavy balls on the heavier side. Repeat the third stage with the potential odd balls.
The process stops when there are at most two potential odd balls:
- If there is a single potential odd ball, it's the one.
- If there are two balls marked heavy, weigh one of them against a known-standard ball. (There will be one, courtesy of stage 2, except if you started with two balls, in which case the problem cannot be solved.)
- If there are two balls with different markings, weigh them against each other.
In all cases, the last weighing reveals the odd ball, and its marking indicates whether it is lighter or heavier.