java.lang.Objectunit4.utilsLib.BinTreeUtils
public final class BinTreeUtils
Method Summary | |
---|---|
static BinTree<String> |
buildExpressionTree(String exp)
|
static BinTree<Integer> |
buildRandomTree(int maxNodes,
int low,
int high)
|
static
|
clone(BinTree<?> tree)
|
static boolean |
exists(BinTree<Integer> tree,
int x)
|
static
|
height(BinTree<?> tree)
|
static
|
inOrderTraversal(BinTree<?> tree)
|
static boolean |
isAllPositive(BinTree<Integer> tree)
|
static
|
isFull(BinTree<?> tree)
|
static
|
isLeaf(BinTree<?> tree)
|
static
|
levelOrderTraversal(BinTree<?> tree)
|
static int |
max(BinTree<Integer> tree)
|
static
|
numOfLeaves(BinTree<?> tree)
|
static
|
numOfNodes(BinTree<?> tree)
|
static
|
parent(BinTree<?> tree,
BinTree<?> childe)
|
static
|
postOrderTraversal(BinTree<?> tree)
|
static
|
preOrderTraversal(BinTree<?> tree)
|
static
|
showTree(BinTree<?> tree, String... title)
|
static int |
sumOfNodes(BinTree<Integer> tree)
|
static int |
sumOfNodesInLevel(BinTree<Integer> tree,
int level)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void showTree(BinTree<?> tree, String... title)
tree
- עץ בינרי גנריtitle
- פרמטר אופציונאלי: כותרת החלון בו יוצג העץ הבינריpublic static BinTree<String> buildExpressionTree(String exp)
exp
- מחרוזת המייצגת ביטוי חשבוני תקין
public static BinTree<Integer> buildRandomTree(int maxNodes, int low, int high)
maxNodes
- מספר צמתים מקסימליlow
- ערך מינימלי שיכול להיות בעץhigh
- ערך מקסימלי שיכול להיות בעץ
public static String preOrderTraversal(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static String inOrderTraversal(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static String postOrderTraversal(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static String levelOrderTraversal(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static int height(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static int numOfNodes(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static BinTree<?> clone(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static boolean isFull(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static int max(BinTree<Integer> tree)
tree
- עץ בינרי של מספרים שלמים
public static int sumOfNodes(BinTree<Integer> tree)
tree
- עץ בינרי של מספרים שלמים
public static int sumOfNodesInLevel(BinTree<Integer> tree, int level)
tree
- עץ בינרי של מספרים שלמיםlevel
- רמה בעץ(מספר גדול או שווה לאפס)
public static boolean isAllPositive(BinTree<Integer> tree)
tree
- עץ בינרי של מספרים שלמים
public static boolean exists(BinTree<Integer> tree, int x)
tree
- עץ בינרי של מספרים שלמיםx
- ערך לחיפוש
public static boolean isLeaf(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static int numOfLeaves(BinTree<?> tree)
tree
- עץ בינרי גנרי
public static BinTree<?> parent(BinTree<?> tree, BinTree<?> childe)
tree
- עץ בינרי גנריchilde
- הפנייה לצומת בעץ