Java Share an insight from having analyzed your colleague’s posting and applicat
ID: 3853155 • Letter: J
Question
Java
Share an insight from having analyzed your colleague’s posting and application.
Or Offer your opinion and possible alternatives for solution details.
Or Evaluate and validate an idea with your own experience.
Or Make a suggestion and expand on below
A tree is a basically a data structure consisting of nodes organized as a hierarchy, it does not contain data but a view of the data by querying it’s a data model. Trees consists of nodes in descending order and every tree has a root node. Tree nodes can have children called branch nodes and those which cannot have children called leaf nodes. Note that the nodes can be identified either by tree path or by display row, where each row displays one node. Advantages of Trees They reflect structured relationships in data Trees are used to represent hierarchies Trees provide an efficient insertion and searching Very flexible data, allowing to move subtrees around with minimum effort. I would like to talk about binary Tree and Red Black Tree; Binary Tree; In binary tree each node has zero, one and two making tree operations simple and efficient. The methods for binary tree are preorder, post order and in-order. The recursively traverse both the left and right sub-trees and visit the current node. As far as the Red Black Tree; It self-balances the structure that applies color to each of its nodes Each node must be either red or black The root is always black every red node must have two black child nodes. Every path from a node to any of its descendent trees must contain the same number black nodes.
Explanation / Answer
Hi,
I have expanded the given detail including some commonly used terms ,types of tree data structures used and also advantages of trees as well.
===================================================================================
Tree (Data Structure):-
A tree is a type of Abstract Data Type(ADT –defined by its behavior) which simulate tree structure.
A tree has root node and subtrees.The subtrees are called children.
The tree nodes are of following types:-
a) Internal nodes:-nodes of tree other than root node.
b) Branch nodes:-nodes can have children called branch nodes.
c) Leaf nodes:-Nodes which cannot have children are called Leaf nodes.
Other than these other terminologies of Trees are:-
Parent
The root of child.
Siblings
A group of nodes with the same parent.
Descendant
A node reachable by proceeding from parent to child.
Ancestor
A node reachable by proceeding from child to parent.
Degree
The number of sub trees of a node.
Edge
The connection between one node and other.
Height of tree
The height of a tree is the height of its root node.
Depth
The depth of a node is the number of edges from the tree's root node to the node.
There are different types of tree data structures available for different purposes.Some of them are listed below.
Below are the major types of trees data structure:-
1. Binary Tree:-This type of tree can have maximum two children. There are also types of binary trees such as full binary tree, complete binary tree and perfect binary tree.
The tree can be accessed in following order:-
Pre-Order:-Root node THEN Left node THEN Right node
Post-Order:-Left node THEN Right Node THEN Root Node
In-Order:-Left node THEN Root node Then Right Node
2. Binary search tree:-This type of tree maintains property that left child node has value less than parent node and right child node has value greater than parent node.
3. AVL tree or height balanced binary tree:-In this tree height difference between left and right sub tree can be at most 1
4. Red-Black tree: - It is similar to AVL tree having red and black nodes and is self balancing binary trees.
The root is always black every red node must have two black child node. Every path from a node to any of its descendent trees must contain the same number black nodes.
5. Splay Tree:- It is a type of self adjusting binary search tree having property that recently used elements are easier and quick to access again.
Advantages of Trees are:-
1) They reflect structured relationships in data
2) The item can be quickly stored, searched when stored in form of tree.
=====================================================================================
Please let me knowi n case more information is required.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.