jds.util
Class PreorderTreeTraversal

java.lang.Object
  |
  +--jds.util.PreorderTreeTraversal

public class PreorderTreeTraversal
extends java.lang.Object
implements java.util.Enumeration

PreorderTreeTraversal - traverse a binary tree in preorder fashion; for use with book Classic Data Structures in Java by Timothy A Budd, published by Addison-Wesley, 2001.


Constructor Summary
PreorderTreeTraversal(BinaryNode root)
          initialize a traversal rooted at given node
 
Method Summary
 boolean hasMoreElements()
          see if enumeration has at least one more element
static void main(java.lang.String[] args)
           
 java.lang.Object nextElement()
          return the next element in the enumeration
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreorderTreeTraversal

public PreorderTreeTraversal(BinaryNode root)
initialize a traversal rooted at given node
Parameters:
root - start of traversal
Method Detail

hasMoreElements

public boolean hasMoreElements()
see if enumeration has at least one more element
Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
return the next element in the enumeration
Specified by:
nextElement in interface java.util.Enumeration
Returns:
the value of the current element

main

public static void main(java.lang.String[] args)