Please enable JavaScript.
Coggle requires JavaScript to display documents.
CHAPTER 5: TREE, shahrul(slide 13), shahrul(slide 43), AYUNA SLIDE26),…
CHAPTER 5: TREE
PART 1
BINARY TREE [gibson]
Each node in a tree data structure contains at most two child nodes, which are commonly labelled "left" and "right."
-
(Mauldorna, Slide 15)
COMPLETE & FULL BINARY TREE
- complete both of the tree
-
FULL BINARY TREE
- A full binary tree can be defined as a binary tree in which all the nodes have 0 or two children.
- In other words, the full binary tree can be defined as a binary tree in which all the nodes have two children except the leaf nodes.
-
-
-
-
-
athirah (slide 11)
SKEWED BINARY TREE
- type of binary tree in which all the nodes have only either one child or no child.
erika (slide 5)
TREE DESCRIPTION
- Has root node
- Each node may not have child node, one or more child node
- Each node will have one node as parent node except root node
-
WAN (Slide 11)
TYPE OF BINARY TREE
- SKEWED BINARY TREE
- COMPLETEBINARY TREE
- FULL BINARY TREE
- COMPLETE AND FULL BINARY TREE
ARIF (SLIDE 4)
TREE
a tree is a data structure that emulates a hierarchical tree structure with a set of linked nodes to solve problems
Node- is a structure which may contain a value, a condition, or represent a separate data structure
Types of tree : general tree, binary tree, binary search tree, AVL tree and etc
-
PART 3
(Mauldorna , Slide 45)
CONVERSION INFIX TO PREFIX
first technique
- uses the notion of a fully parenthesized expression
A + B * C
- written as (A + (B * C))
- to show explicitly that the multiplication has precedence over the addition
to get prefix notation
- we move the operator to the left
-
-
Wardina(slide 44)
ADDITIONAL EXAMPLE OF INFIX, PREFIX, POSTFIX EXPRESSION
- INFIX : ( A + B ) * (C + D )
- PREFIX : * + A B + C D
- POSTFIX : A B + C D + *
- INFIX : ( A + B C ) + ( ( C E + F ) * G )
- PREFIX : + + A B C + * C E F G
- POSTFIX : A B C + C E F + G * +
- INFIX : ( 25 * 3 ) / ( 10 - 5 )
- PREFIX : / * 25 3 - 10 5
- POSTFIX : 25 3 * 10 5 - /
POSTFIX NOTATION
Postfix also known as Reverse Polish Notation (or RPN), is a notational system where the operation/function follows the arguments.
-
Syazwan (Slide 47)
-
CREATE POSTFIX TREE
1.First, make parenthesis of two operand that near the operator
2.Then make parenthesis next two nearest parenthesis with operator until all being parenthesis
-
-
athirah (slide 42)
PREFIX NOTATION
a form of notation for logic, arithmetic, and algebra.
-
-
-
-
PART 2
BST TRAVERSAL [gibson]
Each sub-tree's elements can be retrieved in-order by traversing the left subtree of the root node, then accessing the node itself, and so on.
-
-
-
Jazrin (slide 28)
REMOVE WITH ONE CHILD
- If node that want to be remove has one child (whether left or right)
- Chain the parent node that want to be removed to the child node that want to be removed. Child node will replace the node that wants to be removed.
- From image below: V as a root, B and Y as parent node and A, X and Z as child node. A is child node for B. B will be removed, so the chain will moved to A which is A will replace the B.
-
Removed item from tree procedure must be done carefully so that the Binary Search Tree characteristic is still applied after the operation. Before deleting items from BST, the types of items to be eliminated must be specified. There are three types of items that need to be removed:
- Item with no child (Leaf node)
-
-
erika (slide 30)
-Find inorder successor of the node. Copy contents of the inorder successor to the node and delete the inorder successor. Note that inorder predecessor can also be used.
-
ARIF (SLIDE 29)
REMOVE WITH TWO CHILD
Clarify node to replace the removing node. Make sure that the characteristic of BST are still implemented.
-
-
-
-
-
-
-
-
-
-
-