SlideShare a Scribd company logo
Atal Bihari Vajpayee Vishwavidyalaya Bilaspur Chhattisgarh
Session 2025-
26
Guidance By:-
Mr.Jitendra Kumar Sir
Assistant Professor
Presented By:-
Ravindra Singh Rathore
Binary Tree And Its Operation
Subject:- Data StructureAndArchitecture
Outline
• Tree
• Binary tree Implementation
• Binary Search Tree
• BST Operations
• Traversal
• Insertion
• Deletion
• Types of BST
• Complexity in BST
• Applications of BST
Trees
Tree
• Each node can have 0 or more children
• A node can have at most one parent
Binary tree
• Tree with 0–2 children per node
• Also known as Decision Making Tree
Trees
Terminology
• Root  no parent
• Leaf  no child
• Interior  non-leaf
• Height  distance from root to leaf (H)
Why is h important?
The Tree operations like insert, delete, retrieve etc. are typically
expressed in terms of the height of the tree h.
So, it can be stated that the tree height h determines running
time!
Binary Search Tree
Key property is value at node
• Smaller values in left subtree
• Larger values in right subtree
Example
X > Y
X < Z
Y
X
Z
Binary Search Tree
Examples
Binary search
trees
Not a binary
search tree
5
10
30
2 25 45
5
10
45
2 25 30
5
10
30
2
25
45
Difference between BT and BST
• A binary tree is simply a tree in which each node can have at most
two children.
• A binary search tree is a binary tree in which the nodes are
assigned values, with the following restrictions :
1. No duplicate values.
2. The left subtree of a node can only have values less than the
node
3. The right subtree of a node can only have values greater than the
node and recursively defined
4. The left subtree of a node is a binary search tree.
5. The right subtree of a node is a binary search tree.
Binary Tree Search Algorithm
TREE-SEARCH(x,k)
• If x==NIL or k==x.key
• return x
• If k < x.key
• return TREE-SEARCH(x.left,k)
• else
• return TREE-SEARCH(x.right,k)
BST Operations
Four basic BST operations
1
2
3
4
Traversal
Search
Insertion
Deletion
BINARY TREE data structure and algorithm-1.pptx
BST Traversal
Preorder Traversal
23 18 12 20 44 35 52
Root Left Right
Postorder Traversal
12 20 18 35 52 44 23
Left Right Root
Inorder Traversal
12 18 20 23 35 44 52
Produces a sequenced list
Left Root Right
BINARY TREE data structure and algorithm-1.pptx
Complexity in BST
Operation Average Worst Case Best Case
Search O(log n) O(n) O(1)
Insertion O(log n) O(n) O(1)
Deletion O(log n) O(n) O(1)
Applications of BST
• Used in many search applications where data is constantly
entering/leaving, such as the map and set objects in many
languages' libraries.
• Storing a set of names, and being able to lookup based on a
prefix of the name. (Used in internet routers.)
• Storing a path in a graph, and being able to reverse any
subsection of the path in O(log n) time. (Useful in travelling
salesman problems).
• Finding square root of given number
• allows you to do range searches efficiently.
https://youtu.be/z0Vnno96_MA?si=8fNE4gD3Wt8RwfBg
https://youtu.be/sXABdGalFNg?si=SMJSlxxICHM8FLwt
https://youtu.be/hL9RUD33nYs?si=JpDaKUJJSNl9Z7Gv
https://youtu.be/uI77Ij5Kiic?si=_V_pLSKwMJUKISZE
https://youtu.be/XRcC7bAtL3c?si=Z_hNHUrnB7f_6Yse
References

More Related Content

PPTX
presentation 1 binary search tree in data structures.pptx
PPTX
Data Structures using Python(generic elective).pptx
PPTX
learn tree, linked list, queue, stack, and other algo
PPTX
4. Apply data structures such as arrays, linked lists, and trees as an abstra...
PPT
BINARY SEARCH TREE
PPTX
Group 5-DSA.pptx........................
PPTX
Lecture 09 - Binary Search Trees.pptx mission Sk it
presentation 1 binary search tree in data structures.pptx
Data Structures using Python(generic elective).pptx
learn tree, linked list, queue, stack, and other algo
4. Apply data structures such as arrays, linked lists, and trees as an abstra...
BINARY SEARCH TREE
Group 5-DSA.pptx........................
Lecture 09 - Binary Search Trees.pptx mission Sk it

Similar to BINARY TREE data structure and algorithm-1.pptx (20)

PDF
Binary Search Tree (BST) Explained Step-by-Step
PPTX
Binary Search Tree.pptx
PPTX
Unit 3 - Part 1_Threaded Binary Tree.pptx
PPTX
Binary Search Tree (BST) - A Complete pt
PPT
The chapter highlights the need for targeted education, support programs, and...
PPTX
Introduction to Tree_Data Structure.pptx
PPTX
BST.pptx
PPTX
tree-160731205832.pptx
PPT
bst-class-220902051152-cdddddddddddddddddd5e6c70f.ppt
PPT
Binary Search Tree
PPTX
Data Str Data Str Data Str Data Str Data Str
PDF
PPTX
BASIC TREE AND TYPES OF DI CONCEPTS.pptx
PPTX
Binary tree
PPTX
Splay tree
PPTX
BST.pptx this isp used for learning binary search trees
PPTX
BST.pptx this is Good for data structure
PDF
210 trees5
PPTX
nptel 2nd presentation.pptx
Binary Search Tree (BST) Explained Step-by-Step
Binary Search Tree.pptx
Unit 3 - Part 1_Threaded Binary Tree.pptx
Binary Search Tree (BST) - A Complete pt
The chapter highlights the need for targeted education, support programs, and...
Introduction to Tree_Data Structure.pptx
BST.pptx
tree-160731205832.pptx
bst-class-220902051152-cdddddddddddddddddd5e6c70f.ppt
Binary Search Tree
Data Str Data Str Data Str Data Str Data Str
BASIC TREE AND TYPES OF DI CONCEPTS.pptx
Binary tree
Splay tree
BST.pptx this isp used for learning binary search trees
BST.pptx this is Good for data structure
210 trees5
nptel 2nd presentation.pptx
Ad

Recently uploaded (20)

DOC
学位双硕士UTAS毕业证,墨尔本理工学院毕业证留学硕士毕业证
PPTX
Tablets And Capsule Preformulation Of Paracetamol
PDF
natwest.pdf company description and business model
PPTX
Relationship Management Presentation In Banking.pptx
PDF
Swiggy’s Playbook: UX, Logistics & Monetization
PDF
Parts of Speech Prepositions Presentation in Colorful Cute Style_20250724_230...
PPTX
_ISO_Presentation_ISO 9001 and 45001.pptx
PPTX
Intro to ISO 9001 2015.pptx wareness raising
PPTX
worship songs, in any order, compilation
PDF
Nykaa-Strategy-Case-Fixing-Retention-UX-and-D2C-Engagement (1).pdf
PPTX
Primary and secondary sources, and history
PDF
oil_refinery_presentation_v1 sllfmfls.pdf
PPTX
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
PDF
Presentation1 [Autosaved].pdf diagnosiss
PPTX
S. Anis Al Habsyi & Nada Shobah - Klasifikasi Hambatan Depresi.pptx
PPTX
Impressionism_PostImpressionism_Presentation.pptx
PPTX
Learning-Plan-5-Policies-and-Practices.pptx
PPTX
2025-08-10 Joseph 02 (shared slides).pptx
PPTX
Introduction to Effective Communication.pptx
PPTX
PHIL.-ASTRONOMY-AND-NAVIGATION of ..pptx
学位双硕士UTAS毕业证,墨尔本理工学院毕业证留学硕士毕业证
Tablets And Capsule Preformulation Of Paracetamol
natwest.pdf company description and business model
Relationship Management Presentation In Banking.pptx
Swiggy’s Playbook: UX, Logistics & Monetization
Parts of Speech Prepositions Presentation in Colorful Cute Style_20250724_230...
_ISO_Presentation_ISO 9001 and 45001.pptx
Intro to ISO 9001 2015.pptx wareness raising
worship songs, in any order, compilation
Nykaa-Strategy-Case-Fixing-Retention-UX-and-D2C-Engagement (1).pdf
Primary and secondary sources, and history
oil_refinery_presentation_v1 sllfmfls.pdf
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
Presentation1 [Autosaved].pdf diagnosiss
S. Anis Al Habsyi & Nada Shobah - Klasifikasi Hambatan Depresi.pptx
Impressionism_PostImpressionism_Presentation.pptx
Learning-Plan-5-Policies-and-Practices.pptx
2025-08-10 Joseph 02 (shared slides).pptx
Introduction to Effective Communication.pptx
PHIL.-ASTRONOMY-AND-NAVIGATION of ..pptx
Ad

BINARY TREE data structure and algorithm-1.pptx