Comparator<TreeNode>
public class TreeNodeComparatorBySubtreeSize extends Object implements Comparator<TreeNode>
Constructor | Description |
---|---|
TreeNodeComparatorBySubtreeSize() |
Instantiates a new comparator sorting subtrees ascending.
|
TreeNodeComparatorBySubtreeSize(boolean reverse) |
Instantiates a new comparator.
|
Modifier and Type | Method | Description |
---|---|---|
int |
compare(TreeNode o1,
TreeNode o2) |
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public TreeNodeComparatorBySubtreeSize()
public TreeNodeComparatorBySubtreeSize(boolean reverse)
true
subtrees are
sorted in descending order, otherwise ascending.reverse
- the reversepublic int compare(TreeNode o1, TreeNode o2)
compare
in interface Comparator<TreeNode>
Copyright © 2018 SEMS project @ University of Rostock. All rights reserved.