< Free Open Study > |
We should be old hands at looking at an ADT from the logical level by now. We know that we need an operation to put an item into the structure (). We need to be able to delete an item from the structure (). We need the usual complement of observer functions (, , , and ). Let's also include a () operation and a () operation.
Traversals are more complicated in a binary search tree. In the List ADTs we have examined so far, we have traversed the structure in only two ways: from front to back or from back to front. In all but the SpecializedList class, we have started at the beginning of the list and continued until we accessed all the items. In fact, there are many ways to traverse the items in a tree. We let the client determine which way to traverse the tree by passing a traversal name as a parameter to the and operations. We discuss traversals in much more detail later in the chapter.
Binary Search Tree Specification
< Free Open Study > |
Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |