JavaAlgorithms
Elementary and no so elementary Java algorithms
|
Classes | |
interface | NodeVisitor< T extends Comparable< T > > |
Static Public Member Functions | |
static< TextendsComparable< T > boolean | isOrdered (TreeNode< T > root) |
static< TextendsComparable< T > void | inOrder (TreeNode< T > root, NodeVisitor< T > visitor) |
Algorithms Jun 20, 2013
Definition at line 16 of file Algorithms.java.
static <TextendsComparable<T> void treeAlgorithms.Algorithms.inOrder | ( | TreeNode< T > | root, |
NodeVisitor< T > | visitor | ||
) | [static] |
In-order tree traversal. For an ordered tree, this will visit the nodes in increasing order.
root | the current root of the tree |
visitor | a class that implements NodeVisitor that performs an operation when the tree node is visited. |
visit | an object that implements the visit() method to so something when the node is visited. |
Definition at line 97 of file Algorithms.java.
static <TextendsComparable<T> boolean treeAlgorithms.Algorithms.isOrdered | ( | TreeNode< T > | root | ) | [static] |
A function that tests whether a tree is ordered or not. One can imagine a use for such a function. This is an interview question during a very unpleasant interview at Sumo Logic.
root | the root of a binary tree |
Definition at line 47 of file Algorithms.java.