Recursion

How to Implement the Paint Fill

Emulating paint fill is easy and can be done either iteratively or thru stacks. This demonstration is done using plain text, but the same idea could be implemented using your favorite graphics framework.

First, we're given a two-dimensional array of canvass of type char with size [N][M], where N is the number of rows and M is the number of columns.

Let's suppose N = 11 and M = 15, but of course, the values of these two may vary.

How to Generate a Square Star Fractal Using Recursion

This article is about generating a Square Star Fractal using recursion (Although a triple for-loop implementation is much preferred, it will be discussed separately).

The logic of a Recursive Square Star Fractal Function is a simple Divide and Conquer algorithm. The program is subdivided into smaller tasks until it is solved. The function takes the (X, Y) middle coordinates of the square, R length, where 1 Side of Square = 1 Length = 2R length, and T as the number of times to generate 2R- sized squares. 

Tags:

Techniques How to Remove Any Recursion

A function that calls itself is hard to visualize for most developers. Common software requirements are implemented thru loops, arrays, variables, and automated function calls thus making the use of recursion and variations of the list data structure unusual. In this article, we will take a look at how we can remove any recursive program by following the simple techniques described below. It is very important to understand that this article is not saying that recursion is bad.

Subscribe to RSS - Recursion