notes35 - Mutual recursion is what makes it possible to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Mutual recursion is what makes it possible to explore the two-dimensional tree data structure fully. In particular, note that reaching the base case in forest-map does not mean that the entire tree has been visited! It means merely that one group of sibling nodes has been visited (a “horizontal” base case), or that a node has no children (a “vertical” base case). The entire tree has been seen when every child of the root node has been completed. Note that we use cons , car , and cdr when manipulating a forest, but we use make-tree , datum , and children when manipulating a tree. Some students make the mistake of thinking that data abstraction means “always say datum instead of car ”! But that defeats the purpose of using different selectors and constructors for different data types. • Deep lists Trees are our first two-dimensional data structure. But there’s a sense in which any list that has lists as elements is also two-dimensional, and can be viewed as a kind of tree. We’ll use the nameelements is also two-dimensional, and can be viewed as a kind of tree....
View Full Document

This note was uploaded on 02/17/2010 for the course COMPUTER S 26275 taught by Professor Harvey,b during the Spring '10 term at University of California, Berkeley.

Ask a homework question - tutors are online