AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.BinaryTreeTraversal< T >.LevelorderIterator Class Reference

level-order iterator for BinaryTree More...

+ Inheritance diagram for aud.BinaryTreeTraversal< T >.LevelorderIterator:
+ Collaboration diagram for aud.BinaryTreeTraversal< T >.LevelorderIterator:

Public Member Functions

boolean hasNext ()
 
void remove ()
 
BinaryTree< T > next ()
 
- Public Member Functions inherited from aud.BinarySearchTree.Iterator< BinaryTree< T > >
boolean hasNext ()
 
Cursor next ()
 
void remove ()
 not implemented More...
 

Detailed Description

level-order iterator for BinaryTree

Definition at line 211 of file BinaryTreeTraversal.java.

Member Function Documentation

◆ hasNext()

boolean aud.BinaryTreeTraversal< T >.LevelorderIterator.hasNext ( )

Definition at line 219 of file BinaryTreeTraversal.java.

219 {
220 return !queue_.is_empty();
221 }

◆ next()

BinaryTree< T > aud.BinaryTreeTraversal< T >.LevelorderIterator.next ( )

Definition at line 227 of file BinaryTreeTraversal.java.

227 {
228 BinaryTree<T> node=queue_.dequeue(); // may throw!
229 if (node.getLeft()!=null) queue_.enqueue(node.getLeft());
230 if (node.getRight()!=null) queue_.enqueue(node.getRight());
231 return node;
232 }

◆ remove()

void aud.BinaryTreeTraversal< T >.LevelorderIterator.remove ( )
Exceptions
UnsupportedOperationException(not implemented)

Definition at line 223 of file BinaryTreeTraversal.java.

223 {
224 throw new UnsupportedOperationException();
225 }

The documentation for this class was generated from the following file: