25.11.2014 Views

Algorithms and Data Structures

Algorithms and Data Structures

Algorithms and Data Structures

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

N.Wirth. <strong>Algorithms</strong> <strong>and</strong> <strong>Data</strong> <strong>Structures</strong>. Oberon version 105<br />

x0 := x0 + (u DIV 2); y0 := y0 + (u DIV 2);<br />

Draw.Set(x0, y0);<br />

A(i)<br />

UNTIL i = n<br />

END Hilbert.<br />

Fig. 3.4. Hilbert curves H 1 … H 5 .<br />

A similar but slightly more complex <strong>and</strong> aesthetically more sophisticated example is shown in Fig. 3.6.<br />

This pattern is again obtained by superimposing several curves, two of which are shown in Fig. 3.5. S i is<br />

called the Sierpinski curve of order i. What is its recursion scheme? One is tempted to single out the leaf<br />

S 1 as a basic building block, possibly with one edge left off. But this does not lead to a solution. The<br />

principal difference between Sierpinski curves <strong>and</strong> Hilbert curves is that Sierpinski curves are closed<br />

(without crossovers). This implies that the basic recursion scheme must be an open curve <strong>and</strong> that the four<br />

parts are connected by links not belonging to the recusion pattern itself. Indeed, these links consist of the<br />

four straight lines in the outermost four corners, drawn with thicker lines in Fig. 3.5. They may be regarded<br />

as belonging to a non-empty initial curve S 0 , which is a square st<strong>and</strong>ing on one corner. Now the recursion<br />

schema is readily established. The four constituent patterns are again denoted by A, B, C <strong>and</strong> D, <strong>and</strong> the<br />

connecting lines are drawn explicitly. Notice that the four recursion patterns are indeed identical except for<br />

90 degree rotations.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!