Recursive Dynamic Structures
Collapse the table of content
Expand the table of content

Recursive Dynamic Structures

Visual Studio 6.0

You'll normally use iterative code to loop through the elements of a simple, linear dynamic data structure. On the other hand, many popular dynamic data structures lend themselves to being traversed recursively. For example, programmers often use the ordered binary tree structure for data storage and quick retrieval. In this kind of structure, each node has one predecessor and two successors. (Normally, you think of one successor as being the “left child” and the other as the “right child.”) Figure 6.2 shows the simplest recursive data structure: a binary tree. The tree data structure is well suited to recursive algorithms for adding items and traversing the nodes.

Figure 6.2: Ordered binary trees are an example of a recursive data structure.

The term dynamic data structures always refers to in-memory data structures. All the techniques covered in this chapter deal only with data that you work with in the current instance of your application and have nothing to do with storing or retrieving that data from permanent storage. VBA provides its own techniques for reading and writing disk files. (See Chapter 5 for an example using a class module to read text files.) You'll use the data structures presented in this chapter once you've retrieved the data you need to work with.

© 1997 by SYBEX Inc. All rights reserved.

© 2016 Microsoft