The algorithm name is after some mathematician.
You can traverse image line by line of course, but you can traverse image using recursive generated path, which the basic blocks looks like:
U
This one is for traversal 2x2 pixels image. If you have bigger image, you "multiply" this block (rotated or not) for each segment. The result is snake-like path.
So, maybe you remember the name of this algorithm :-) Thank you in advance.