jds.util
Class LevelorderTreeTraversal
java.lang.Object
|
+--jds.util.LevelorderTreeTraversal
- public class LevelorderTreeTraversal
- 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.
Method Summary |
boolean |
hasMoreElements()
see if enumeration has at least one more element |
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 |
LevelorderTreeTraversal
public LevelorderTreeTraversal(BinaryNode root)
- initialize a newly created traversal enumerator
- Parameters:
root
- start node for traversal
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