java.lang.Objectunit4.utilsLib.BinTreeUtils
public final class BinTreeUtils
Method Summary | |
---|---|
static BinTree |
buildRandomTree(int maxNodes,
int low,
int high)
|
static
|
clone(BinTree tree)
|
static boolean |
exists(BinTree tree,
int x)
|
static
|
height(BinTree tree)
|
static
|
inOrderTraversal(BinTree tree)
|
static boolean |
isAllPositive(BinTree tree)
|
static
|
isFull(BinTree tree)
|
static
|
isLeaf(BinTree tree)
|
static
|
levelOrderTraversal(BinTree tree)
|
static int |
max(BinTree 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 tree)
|
static int |
sumOfNodesInLevel(BinTree 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 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 tree)
tree
- עץ בינרי של מספרים שלמים
public static int sumOfNodes(BinTree tree)
tree
- עץ בינרי של מספרים שלמים
public static int sumOfNodesInLevel(BinTree tree, int level)
tree
- עץ בינרי של מספרים שלמיםlevel
- רמה בעץ(מספר גדול או שווה לאפס)
public static boolean isAllPositive(BinTree tree)
tree
- עץ בינרי של מספרים שלמים
public static boolean exists(BinTree 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
- הפנייה לצומת בעץ