Friday, 8 September 2017

chapter 4 : Tress

In this chapter , I have learned about tress . Tress is a connected undirected graph with no simple circuit . 
                                             


 Besides , I also learned  which is a  rooted tree . Rooted tree is a tree in which one vertex has been designated as the root and very edge is directed away from the root . Example :

 Other than that , terminology of trees have parent , ancestor , child , siblings , terminal vertices  or leaves (no children), internal verticles (verticles with children) , subtrees , level root level which is start with 0) and height (maximum level).




example question :


Next , in this chapter we also learned about Binary Tree . Binary Tree is a rooted tree which every internal vertex has no more than two children . Example : 



 The vertex designated to left is called the left child, such as 5,9,1,2,3 .The vertex designated to right is called the right child, such as 4, 11, 7, 12.


Next , full binary tree . Full binary tree is a tree which every internal vertex has exactly two children.
Example: 
Complete binary tree . A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all vertices are as far left as possible.
Example:

  

 Full binary tree vs Complete binary tree
                                                                                  
                                                                                          
    example of exercise :

Moreover , A binary search tree (BST), also known as an ordered binary tree, is a node-based data structure in which each node has no more than two child nodes. Each child must either be a leaf node or the root of another binary search tree. The left sub-tree contains only nodes with keys less than the parent node; the right sub-tree contains only nodes with keys greater than the parent node.

                                                   


In a nutshell , it is important for us as IT student to know about discrete maths so that we can apply in our programming or a computer system .