This document defines and provides examples of trees and binary trees. It begins by defining trees as hierarchical data structures with nodes and edges. It then provides definitions for terms like path, forest, ordered tree, height, and multiway tree. It specifically defines binary trees as having two children per node. The document gives examples and properties of binary trees, including full, complete, and binary search trees. It also explains linear and linked representations of binary trees and different traversal methods like preorder, postorder and inorder. Finally, it provides examples of insertion and deletion operations in binary search trees.
Binary search works on sorted arrays. Binary search begins by comparing an element in the middle of the array with the target value. If the target value matches the element, its position in the array is returned. If the target value is less than the element, the search continues in the lower half of the array.
1) Introduction to Trees.
2) Basic terminologies
3) Binary tree
4) Binary tree types
5) Binary tree representation
6) Binary search tree
7) Creation of a binary tree
8) Operations on binary search tree Trees
Binary search works on sorted arrays. Binary search begins by comparing an element in the middle of the array with the target value. If the target value matches the element, its position in the array is returned. If the target value is less than the element, the search continues in the lower half of the array.
1) Introduction to Trees.
2) Basic terminologies
3) Binary tree
4) Binary tree types
5) Binary tree representation
6) Binary search tree
7) Creation of a binary tree
8) Operations on binary search tree Trees
This PPT is all about the Tree basic on fundamentals of B and B+ Tree with it's Various (Search,Insert and Delete) Operations performed on it and their Examples...
A tree is a nonlinear data structure, compared to arrays, linked lists, stacks and queues which are linear data structures. A tree can be empty with no nodes or a tree is a structure consisting of one node called the root and zero or one or more sub-trees.
↓↓↓↓ Read More:
@ Kindly Follow my Instagram Page to discuss about your mental health problems-
-----> https://instagram.com/mentality_streak?utm_medium=copy_link
@ Appreciate my work:
-----> behance.net/burhanahmed1
Thank-you !
This PPT is all about the Tree basic on fundamentals of B and B+ Tree with it's Various (Search,Insert and Delete) Operations performed on it and their Examples...
A tree is a nonlinear data structure, compared to arrays, linked lists, stacks and queues which are linear data structures. A tree can be empty with no nodes or a tree is a structure consisting of one node called the root and zero or one or more sub-trees.
↓↓↓↓ Read More:
@ Kindly Follow my Instagram Page to discuss about your mental health problems-
-----> https://instagram.com/mentality_streak?utm_medium=copy_link
@ Appreciate my work:
-----> behance.net/burhanahmed1
Thank-you !
Tree and Binary search tree in data structure.
The complete explanation of working of trees and Binary Search Tree is given. It is discussed such a way that everyone can easily understand it. Trees have great role in the data structures.
date structure have a great application .Trees are basic important part of this structure . all basic discreption is provided in this presentation . data structure and trees theory .
types of binary search,representation of trees , implementation of trees , important algorithm , extended binary tree , linked list representation of trees. orders in binary trees .
A Binary Tree is a finite set of elements that is either empty or is partitioned into three disjoint subsets. The first subset contains a single element called the Root of the tree. The other two subsets are themselves Binary Trees, called the left and right subtrees of the original tree. A left or right subtree can be empty Fig 1.3 shows a typical Binary Tree. A node of a Binary Tree can have at most two Branches.
If A is the root of a Binary Tree and B,C are the roots of its left and right subtrees respectively then A is said to be the father of B, C and B are called Left and Right Sons respectively. If every Non Leaf node in a Binary Tree has Non Empty Left and Right subtrees the tree is termed as Strictly Binary Tree. The Binary Tree of Fig 1.4 is Strictly Binary Tree. A Strictly Binary Tree with n leaves always contains 2n-1 nodes.
A Complete Binary Tree is a Strictly Binary Tree of depth 'd' whose all leaves are at level d. Fig 1.5 represents complete Binary tree.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Trees in Data Structure
1.
2. Trees: basic definitions and terminology
Contrary to arrays, stacks, queues and sequences all of which are one-
dimensional data structures, trees are two-dimensional data structures with
hierarchical relationship between data items.
Definition 1 A tree is a non-empty collection of vertices (nodes) and edges
that satisfy certain requirements.
Definition 2 A path in a tree is a list of distinct vertices in which successive
vertices are connected by edges in the tree.
One node in the tree is designated as the root. Each tree has exactly one
path between the root and each of the other nodes. If there is more than one
path between the root and some node, or no path at all, we have a graph.
Definition 3 A set of trees is called a forest.
Definition 4 (Recursive definition) A tree is either a single node or a root
node connected to a forest.
3. Example of a tree:
root
siblings
subtree
internal nodes
external nodes, or leaves
4. More definitions
Definition 5 An ordered tree is a tree in which the order of children is
specified.
Definition 6 A level (depth) of a node in the number of nodes on the path
from that node to the root.
Definition 7 The height (maximum distance) of a tree is the maximum
level among all of the nodes in the tree.
Definition 8 The path length of a tree is the sum of the levels of all the
nodes in the tree.
Definition 9 A tree where each node has a specific number of children
appearing in a specific order is call a multiway tree. The simplest type of
a multiway tree is the binary tree. Each node in a binary tree has exactly
two children one of which is designated as a left child, and the other is
designated as a right child.
Definition 10 (Recursive definition) A binary tree is either an external node,
or an internal node and two binary trees.
5. Example of a binary tree
root
left child right child
one or both children
might be external nodes
special external nodes with
no name and no data associated
with them
6. More binary trees examples
1. Binary tree for representing arithmetic expressions. The underlying hierarchical
relationship is that of an arithmetic operator and its two operands.
Arithmetic expression in an infix form: (A - B) + C * (E / F)
+
- *
A B C /
E F
Note that a post-order traversal of this tree (i.e. visiting the left subtree first, right
subtree next, and finally the root) returns the postfix form of the arithmetic
expression, while the pre-order traversal (root is visited first, then the left subtree,
then the right subtree) returns the prefix form of the arithmetic expression.
7. 2. Binary tree with a heap property. The underlying hierarchical relationship
suggests that the datum in each node is greater than or equal to the data in
its left and right subtrees.
87
84 63
68 79 12
32 67 6 10
8 9
8. 3. Binary tree with an ordering property. The underlying hierarchical
relationship suggests that the datum in each node is greater than the data in
its left subtree, and less than or equal to the data in its right subtrees.
87
84 103
68 86 90 109
32 74 88 97
70 80
9. 4. Decision trees. The underlying hierarchical relationship depends on the nature of
the domain represented by the binary tree. For example, consider a domain that
consists of the following statements (from J.Ignizio “Intro to ES”):
If the plane’s engine is propeller, then the plane is C130.
If the plane’s engine is jet and the wing position is low, then the plane is B747.
If the plane’s engine is jet and the wing position is high and no bulges are seen, then
the plane is C5A
If the plane’s engine is jet and the wing position is high and bulges are aft of wing, then
plane is C141 .
The following decision tree can be generated from these rules:
Engine type
Jet Propeller
Wing Position C130
Low High
B747 Bulges
None Aft Wing
C5A C141
10. Properties of binary trees
1. The number of external nodes is 1 more than the number of internal nodes.
It is easy to see this if we start removing external nodes with their internal
parent, one pair at a time (assume that a method removeAboveExternal(n)
does this). At the end of this process, only the root with its two external
children will remain.
2. The number of external nodes is at least h + 1, where h is the height of the
tree, and at most 2
h
. The later holds for a full binary tree, which is a tree
where internal nodes completely fill every level.
3. The number of internal nodes is at least h and at most 2h
- 1.
4. The total number of nodes in a binary tree is at least 2*h + 1 and at most
2
h+1
- 1.
5. The height, h, of a binary tree with n nodes is at least log n+1 and at most
n.
6. A binary tree with n nodes has exactly n - 1 edges.
11. Full binary trees and complete binary trees
Here is an example of a full binary tree:
1
2 3
4 5 6 7
8 9 10 11 12 13 14 15
A complete binary tree is a full binary tree where the internal nodes on the
bottom level all appear to the left of the external nodes on that level. Here is
an example of a complete binary tree:
1
2 3
4 5 6
12. Properties of binary trees (cont.)
The following property holds for a complete binary tree.
Let i be a number assigned to a node in a complete binary tree. Then:
1. If i = 1, then this node is the root of the tree. If i > 1, then the parent of this
node is assigned the number (i / 2).
2. If 2*i > n, then the corresponding node has no left child. Otherwise, the left
child of that node is assigned the number 2*i.
3. If 2*i + 1 > n, then the corresponding node has no right child. Otherwise, the
right child of that node is assigned the number 2*i + 1.
This property suggests a trivial array-based representation of a complete binary
tree, where i is the index of the node in the array. We will see that a slight
modification in this representation allows us to represent any binary tree in a
linear fashion.
13. Linear (or sequence-based) representation of a
binary tree
Linear representation of a binary tree utilizes one-dimensional array of size
2
h+1
- 1. Consider the following tree:
+ level 0 (d = 0)
- * level 1 (d = 1)
A B C / level 2 (d = 2)
E F level 3 (d = 3)
To represent this tree, we need an array of size 23+1
- 1 = 15
The tree is represented as follows:
1. The root is stored in BinaryTree[1].
2. For node BinaryTree[n], the left child is stored in BinaryTree[2*n], and the
right child is stored in BinaryTree[2*n+1]
i: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
BinaryTree[i]: + - * A B C / E F
14. Linear representation of a binary tree (cont.)
Advantages of linear representation:
1. Simplicity.
2. Given the location of the child (say, k), the location of the parent is easy to
determine (k / 2).
Disadvantages of linear representation:
1. Additions and deletions of nodes are inefficient, because of the data
movements in the array.
2. Space is wasted if the binary tree is not complete. That is, the linear
representation is useful if the number of missing nodes is small.
Note that linear representation of a binary tree can be implemented by means
of a linked list instead of an array. For example, we can use the Positional
Sequence ADT to implement a binary tree in a linear fashion. This way the
above mentioned disadvantages of the linear representation will be resolved.
15. Linked representation of a binary tree
Linked representation uses explicit links to connect the nodes. Example:
1
2 5
3 4 6 7
8 9
Nodes in this tree can be viewed as positions in a sequence (numbered 1
through 9).
+
BA
- *
C /
E F
16. Traversals of a binary tree
Preorder traversal
void preOrder (BTNode localRoot) {
if (localRoot != null) {
localRoot.displayBTNode();
preOrder(localRoot.leftChild);
preOrder(localRoot.rightChild); } }
Example Consider a tree with an ordering property, where nodes are inserted
in the following order b i n a r y t r e e, i.e.
b
a i
e n
e r
y
t
r
The preorder traversal is: b a i e e n r y t r
17. Traversals of a binary tree (cont.)
Post-order traversal
void postOrder (BTNode localRoot) {
if (localRoot != null) {
postOrder(localRoot.leftChild);
postOrder(localRoot.rightChild);
localRoot.displayBTNode(); } }
The nodes in the example tree are traversed in post-order as follows:
a e e r t y r n i b
In-order traversal
void inOrder (BTNode localRoot) {
if (localRoot != null) {
inOrder(localRoot.leftChild);
localRoot.displayBTNode();
inOrder(localRoot.rightChild); } }
The nodes in the example tree are traversed in in-order as follows:
a b e e i n r r t y
18. A Binary Search Tree is a binary
tree with the following properties:
All items in the left subtree are less than
the root.
All items in the right subtree are greater or
equal to the root.
Each subtree is itself a binary search tree.
19. Basic Property
In a binary search tree,
the left subtree contains key values less
than the root
the right subtree contains key values
greater than or equal to the root.
20. 7-1 Basic Concepts
Binary search trees provide an excellent structure for searching a
list and at the same time for inserting and deleting data into the
list.
21.
22. Insertion in binary search tree
Insert 9 in the the following tree:
3
2 15
1 11
7 13
Step 1: search for 9 3
2 15
1 11
search stops here 7 13
Step 2: insert 9 at the point where the search terminates unsuccessfully
3
2 15
1 11
7 13 That is, new nodes are always inserted at the leaf level.
9
23. Deletion in binary search tree
Consider the tree:
3 7
2 15 Deleting 3 2 15
1 11 1 11
7 13 13
The following cases of deletions are possible:
1. Delete a note with no children, for example 1. This only requires the appropriate link in
the parent node to be made null.
2. Delete a node which has only one child, for example 15. In this case, we must set the
corresponding child link of the parent’s parent to point to the only child of the node being
deleted.
3. Delete a node with two children, for example 3. The delete method is based on the
following consideration: in-order traversal of the resulting tree (after delete operation)
must yield an ordered list. To ensure this, the following steps are carried out:
Step 1: Replace 3 with the node with the next largest datum, i.e. 7.
Step 2: Make the left link of 11 point to the right child of 7 (which is null here).
Step 3: Copy the links from the node containing 3 to the node containing 7, and make
the parent node of 3 point to 7.