1. How many ancestors does a node at level n in a binary tree have? Provide justification.
The definition of a binary tree states that if a tree is not empty, then a root node has two sub trees Tr and Tl, such that Tr and Tl are binary trees. Under this definition, every node, except for the root node, has one parent. Levels of the tree is a measure of distance from the root node, assuming the root node's level is 1, node n's level is 1 plus the level of its parent. Since the root node is level 1 and every node has one parent, the number of ancestors of a node at level n is n-1.
2. Prove that a strictly binary tree (regular binary tree) with n leaves contains 2n-1 nodes. Provide justification.
A strictly binary tree, full binary tree requires
…show more content…
all nodes to have either 2 children or 0 children. A leaf node contains node children and since we are dealing with binary trees exactly one parent. To satisfy a full binary tree require, a leaf node’s grandparent must have two children, thus for every leaf node there are 2n-1 nodes in the tree (the root node has no parent). 3. How many binary trees exist with n nodes and level k = 3? Justify your answer. Do not count isomorphic tree (ones with the same physical structure). See the diagram in the supplement. The maximum level for a tree with n nodes n-1, so k is at nost n-1 N=4 N=4, k=[0,3], trees=3 Trees N=4, K=0 K=1 K=2 K=3 3 trees we will have. 4. Explain in detail that if m pointer fields are set aside in each node of a general m-ary tree to point to a maximum of m child nodes, and if the number of nodes in the tree is n, the number of null child pointer fields is n*(m-1)+1. M-ary trees have MN pointers (m pointer fields for each node). There are N-1 edges in a M-ary tree (non-Null). Therefore, the number of null child pointer fields is: MN-(n-1)=MN – N+1=N(M-1)+1. 5. Implement maketree, setleft, and setright for right in-threaded binary trees using the sequential rayay representation. class node { int text; node left; node right; public class Thread{ static node maketree(int x) { node p; p = getnode(); p.text = x; p.left = null; p.right = null; p.rthread = true; return p; } static node getnode() { return new node(); } static void setleft(node p, int x) { node q; if (p == null) else { q = getnode(); q.text = x; p.left = q; q.left = null; q.right = p; q.rthread = true; } static void setright(node p, int x) { node q, r; if (p == null) else { q = getnode(); q.text = x; r = p.right; p.right = q; p.rthread = false; q.left = null; q.right = r; q.rthread = true; } 6.
Implement inorder traversal for the right in-thread tree in the previous problem.
void sort(int ray[], int start, int end)
{
if(start > end)
return;
sort(ray, start*2 + 1, end);
printf("%d ", ray[start]);
sort(ray, start*2 + 2, end);
}
int main()
{
int raySize = sizeof(ray)/sizeof(int);
sort(ray, 0, ray_size-1);
getchar();
return 0;
}
7. Define the Fibonacci binary tree of order n as follows: If n=0 or n=1, the tree consists of a single node. If n>1, the tree consists of a root, with the Fibonacci tree of order n-1 as the left subtree and the Fibonacci tree of order n-2 as the right subtree. Write a method that builds a Fibonacci binary tree of order n and returns a pointer to it.
struct node {
int text;
struct node *left;
struct node *right;
}
typedef struct node *node;
node acci(int n)
{
node p = getnode();
if (n == 0 || n == 1) {
p->left = NULL;
p->right = NULL;
}
else
{
p->left = acci(n - 1);
p->right = acci(n - 2);
}
return p;
}
8. Answer the following questions about Fibonacci binary tree defined in the previous
problem. Biometrics are about the same with a 1-bit difference and the hash will not match. a) Is such a tree strictly binary? Yes, the Fibonacci binary tree is strictly binary. b) What is the number of leaves in the Fibonacci tree of order n? A Fibonacci tree consist of n-1 internal nodes (each having two Childs) and n terminal nodes or leaves. c) What is the depth of the Fibonacci tree of order n? Depth is log(n).
Wilford, J. (2004).Another Branch of Early Human Ancestors Is Reported by Scientists. [Online], March. Available at: http://gateway.proquest.com [Accessed 28 March 2004].
how old a tree is. As the tree grows each year, and becomes stronger, the rings build themselves up around
Ø Amount of rainfall that runs down the tree. If it is too much, it
Trees grow into woody plants with a main trunk, many branches, and come in varieties of shapes, leaf types and reproductive organs. Tree roots can spread up to three meters in depth and width, sometimes damaging buildings or footpaths (http://en.wikipedia.org/wiki/Photosynthesis, 2010). All plants photosynthesise, allowing production of their own food, by converting carbon dioxide and water into glucose and oxygen using sunlight energy. Therefore as all organisms release carbon dioxide through respiration, only plants use it to produce oxygen, which is a circular process (http://en.wikipedia.org/wiki/Photosynthesis, 2010).
During the kickoff scene, the origin of the tree being a symbol is starting. Melinda has started her art period. Her teacher, Mr. Freeman, has assigned the class to recreate their chosen object and apply emotion. Melinda chose 'tree.' “He stops by my table. I plunge my hand into the bottom of the globe and fish out my paper. “Tree.” Tree? It’s too easy.” (12) Melinda does not have confidence that this will challenge her. In her mind, a tree isn’t exactly exhilarating.
Japan is an island nation off the coast of East Asia. It is made up of four large islands and about 3,900 smaller ones. On a map, they form a thin crescent moon. All together, they form an area about the size of Montana. To the west, the sea of Japan separates it from its nearest neighbors, Korea and China. To the east lies the Pacific ocean. Japan has a moderate climate. Summers are nice. Winters are mild, with heavy snowfall limited to the north. Japan makes crops due to rain in the summer.
I am a plate that is made of clay that was taken from the Earth of Japan. But before I was made into a plate I was up to the mountains near a big forest that had a Jinja on top a beautiful waterfall where water fell from the top to the bottom and sometimes flowing to rivers. But when winter comes the waterfall would freeze into shards and when the winter goes the shards and snow turn into water filling up the waterfall making a waterfall from the top to the bottom flowing with an immense amount of water to rivers and ponds that would sometimes connect with the waterfall. My maker crafted me to be used as art depicting many natural objects or buildings even sometimes people in the drawing. I am also used to hold a meal for a person who would eat the nourishment from top to bottom. Most of the time I would have fish from the ocean or rice that was farmed in flatlands on top of me.
Rienzo, Anna Di. Wilson, Allan. 1991. Branching pattern in the evolutionary tree for human mitochondrial DNA. Evolution 88: 1597-1601.
Music from Mexico began making its way to America in the late 1800s when border culture and commerce was beginning to develop. Corrido and Ranchera developed and reached popularity in Texas when nortenos music came to Texas. Texas singer Lydia Mendoza’s song “Bad Man” became a hit and played on the radio in the southwestern US which clued listeners in to the border music scene. She and her family continued to record tangos, corridos, rancheras, and boleros that increased the presence of border music in American culture. The accordion came to Mexico in the 1860s and when it was brought over the border into Texas, the conjunto style was popularized in America. The most famous of these are polkas.
explicitly state the type of tree that was forbidden, just as the Book of Genesis only tells of an
If The Tree Has Hard Wood Or Is Very Big
As the boy gets into teen years he begins to take from the tree and the tree loves the boy so without question the tree first gives up time enjoyed by the boy. When the boy is too big to play with the tree he comes asking her for money. The tree does not have any money but she offers her apples for him to sell because he says money will make him happy. Again the tree is left alone, but happy she helped the boy. The next time the boy goes to see the tree the tree “shook with joy and said come, boy, climb my trunk… and be happy” (1965) showing the boy she wanted him to be happy and enjoy time spent.
I assume that you are familiar with the terminology of binary trees, e.g., parents, children, siblings, ancestors, descendants, grandparents, leaf nodes, internal nodes, external nodes, and so on, so I will not repeat their definitions here. Because the definitions of height and depth may vary from one book to another, I do include their definitions here, using the ones from the textbook.
Fibonacci Numbers originated from India hundreds of years ago. Though Fibonacci Numbers came from India, Leonardo of Pisa, better known as Fibonacci, made it known to the world. Leonardo came from a wealthy Italian family and traveled to North America to join his father. He was educated by the Moors and sent on business trips. “After returning to Pisa around 1200, Leonardo wrote his most famous literature, Liber Abaci” (Pearson). Leonardo featured a rabbit question in the book. The question was asked in a mathematical competition, he appeared in when he was young. Leonardo Fibonacci used the Fibonacci Numbers to solve it. Fibonacci Numbers is now used throughout our society.
First, a tree begins life as a tiny seed embedded in the Earth, but with time and nourishment it grows. I too, started life as a small sapling and continued to grow. Along with growth, roots begin to develop. Roots are essential for a tree’s survival. They provide the tree with nutrients in order for it to survive, just as my mother provided me with nutrients and instilled in me skills I use today. The development of roots requires time and dedication. The tree must be exposed to sunlight and water. Sunlight gives the tree energy, and water saturates the roots forming them deeply. Deeply formed roots are able to stand throughout all the effects and actions of nature/environment. My roots are my faith and my mother. Simply having a relationship with Christ stimulates root growth. The full development of my roots occurs when I have devoted my time to saturate them by studying His word and dep...