0% found this document useful (0 votes)
52 views1 page

What Is A Tree

A tree is a non-linear data structure that organizes data hierarchically with a root node, branches, and leaf nodes. It consists of nodes connected in a parent-child relationship, where each node can have zero or more child nodes but only one parent node, except for the root which has no parent. Trees are used to represent hierarchical data like directory structures and classification systems.

Uploaded by

balaanand_mca
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views1 page

What Is A Tree

A tree is a non-linear data structure that organizes data hierarchically with a root node, branches, and leaf nodes. It consists of nodes connected in a parent-child relationship, where each node can have zero or more child nodes but only one parent node, except for the root which has no parent. Trees are used to represent hierarchical data like directory structures and classification systems.

Uploaded by

balaanand_mca
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

What is a Tree?

Non-linear data structure Hierarchical arrangement of data Has components named after natural trees root branches leaves Drawn with root at the top Johns Hopkins Department of Computer Science Course 600.226: Data Structures, Professor: Jonathan Cohen Components of a Tree Node: stores a data element Parent: single node that directly precedes a node all nodes have 1 parent except root (has 0) Child: one or more nodes that directly follow a node Ancestor: any node which precedes a node itself, its parent, or an ancestor of its parent Descendent: any node which follows a node itself, its child, or a descendent of its child Johns Hopkins Department of Computer Science Course 600.226: Data Structures, Professor: Jonathan Cohen More Tree Terminology Leaf (external) node: node with no children Internal node: non-leaf node Siblings: nodes which share same parent Subtree: a node and all its descendents Ignoring the nodes parent, this is itself a tree Ordered tree: tree with defined order of children enables ordered traversal Binary tree: ordered tree with up to two children per node Examples of Trees Directory tree Organizes directories and files hierarchically

Directories are internal nodes, files are leaf nodes (usually) Class hierarchy Object is root, other classes are descendents Decision tree Binary tree Path taken determined by boolean expression Expression tree Operators are internal nodes, variables and constants are leaf nodes

You might also like