# Category Archive for: Recursive Programming

Recursion is not a technique that most programmers regularly use. Only a few situations call for recursive programming, and unfortunately, these programs can’t be implemented otherwise, The following sections discuss the dangers of recursion and give you a few hints to help you recognize a procedure that cans for recursive programming .. It’s Easy to Write a Never-Ending Program…

Figure 11.8 shows the window of the DirMap application at design time. Notice that the Form contains a second DirListBox control and a FileListBox control, both of which remain invisible at runtime. The FileListBox control is where the program looks for the current folder’s files. Since there’s no reason for the user to watch its contents change a few…

When about recursive procdure, it’s heipful to start with a genral written dflCnpticr ot the-procedure. For the FilcScan application, we need a subroutine (since it’s not going to return a result) that scans the contents of a folder: let’s call it Scanfolderst). The ScanFoldersO subroutine must scan all the entries of the initial folder and process the files…

If you’re mathematically inclined, the examples that were used to introduce the .concepts of recursive programming are quite interesting. But most people aren’t, so let’s look at a couple of practical examples. We’ll return to the Binary Search algorithm we explored in Chapter 5, Basic ActiveX Controls, and implement it with a recursive function. The Binary Search algorithm searches a…

You’ll find the Recurse application in this chapter’s folder on the CO:Load it and .run it. Click the New Color button and the program starts filling the picture box with a random color from left to right. Because the control’s ScaleMode is twips the progress ‘of the drawing is slow, even on a fast Pentium. The code behind…

The Print statements are commented out in the Factorial application. You can remove the apostrophes from in front of them and then run the application to watch the sequence of function calls while the factorial o! a number is being calculated. The first Print statement tells us that a new instance of the function has been activated and…

This chapter is slightly different from the previous ones because it doesn’t ‘  describe specific VlSual Basic techniques or controls. Instead, it introduces a powerful technique for implementipg efficient, compact programs. Recursion is a special topic in computer programming that’s one of the least understood among beginners and even among some advanced programmers. It’s surrounded by an…