Elementary and no so elementary Java algorithms
treeAlgorithms.Algorithms Class Reference

List of all members.


interface  NodeVisitor< T extends Comparable< T > >

Static Public Member Functions

static< TextendsComparable< T >
isOrdered (TreeNode< T > root)
static< TextendsComparable< T >
inOrder (TreeNode< T > root, NodeVisitor< T > visitor)

Detailed Description

Algorithms Jun 20, 2013

Ian Kaplan,

Definition at line 16 of file

Member Function Documentation

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.

rootthe current root of the tree
visitora class that implements NodeVisitor that performs an operation when the tree node is visited.
visitan object that implements the visit() method to so something when the node is visited.

Definition at line 97 of file

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.

rootthe root of a binary tree
true if the tree is ordered (where the left branch is the less than branch and the right branch is the greater than branch), false otherwise.

Definition at line 47 of file

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables