100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Data Structure in programming

Rating
-
Sold
-
Pages
4
Uploaded on
25-05-2023
Written in
2022/2023

In this document you will be familiar with binary tree in data structure. How its look like in and stored in computer memory. Various type of binary tree and their properties.

Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
May 25, 2023
Number of pages
4
Written in
2022/2023
Type
Summary

Subjects

Content preview

Binary Tree
A binary tree consists of a finite set of nodes that is either empty, or consists of one specially
designated node called the root of the binary tree, and the elements of two disjoint binary
trees called the left subtree and right subtree of the root.
Note that the definition above is recursive: we have defined a binary tree in terms of binary
trees. This is appropriate since recursion is an innate characteristic of tree structures.
Diagram 1: A binary tree




Binary Tree Terminology
Tree terminology is generally derived from the terminology of family trees (specifically, the
type of family tree called a lineal chart).
Each root is said to be the parent of the roots of its subtrees.
Two nodes with the same parent are said to be siblings; they are the children of their parent.
The root node has no parent.
A great deal of tree processing takes advantage of the relationship between a parent and
its children, and we commonly say a directed edge (or simply an edge) extends from a
parent to its children. Thus edges connect a root with the roots of each subtree. An
undirected edge extends in both directions between a parent and a child.
Grandparent and grandchild relations can be defined in a similar manner; we could also
extend this terminology further if we wished (designating nodes as cousins, as an uncle or
aunt, etc.).
Other Tree Terms
The number of subtrees of a node is called the degree of the node. In a binary tree, all
nodes have degree 0, 1, or 2.
A node of degree zero is called a terminal node or leaf node.
A non-leaf node is often called a branch node.
The degree of a tree is the maximum degree of a node in the tree. A binary tree is degree
2.
A directed path from node n1 to nk is defined as a sequence of nodes n1, n2, ..., nk such that
ni is the parent of ni+1 for 1 <= i < k. An undirected path is a similar sequence of undirected
edges. The length of this path is the number of edges on the path, namely k – 1 (i.e., the
number of nodes – 1). There is a path of length zero from every node to itself. Notice that
in a binary tree there is exactly one path from the root to each node.
The level or depth of a node with respect to a tree is defined recursively: the level of the
root is zero; and the level of any other node is one higher than that of its parent. Or to put
R145,68
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
jaykumar1

Get to know the seller

Seller avatar
jaykumar1 Kurukshetra University
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
1
Documents
3
Last sold
-

0,0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions