SlideShare a Scribd company logo
Introduction
 A binary search tree is a useful data structure for fast
addition and removal of data.
 It is composed of nodes, which stores data and also
links to upto two other child nodes.
 It is the relationship between the leaves linked to and
the linking leaf, also known as the parent node, which
makes the binary tree such an efficient data structure.
Cont…
 For a binary tree to be a binary search tree, the data of
all the nodes in the left sub-tree of the root node
should be less than the data of the root.
 The data of all the nodes in the right subtree of the
root node should be greater than equal to the data of
the root.
 As a result, the leaves on the farthest left of the tree
have the lowest values, whereas the leaves on the right
of the tree have the greatest values.
Binary Search Tree
Insertion in a BST
 To insert data into a binary tree involves a function
searching for an unused node in the proper position in
the tree in which to insert the key value.

 The insert function is generally a recursive function
that continues moving down the levels of a binary tree
until there is an unused leaf in a position which
follows the following rules of placing nodes.
Cont..
 Compare data of the root node and element to be
inserted.
 If the data of the root node is greater, and if a left
subtree exists, then repeat step 1 with root = root of
left subtree. Else,
 Insert element as left child of current root.
Cont..
 If the data of the root node is greater, and if a right
subtree exists, then repeat step 1 with root = root of
right subtree.
 Else, insert element as right child of current root.
BST Insertion
Assignment
 Explain Binary Search Tree in data structure with
suitable example and discuss basic operation.

More Related Content

PPT
Binary search tree in data structures
chauhankapil
 
PPTX
Data- Structures-Binary-Search-Trees.pptx
selvi653915
 
PPTX
Binary search tree definition operation.pptx
jeevananandk28
 
PPTX
UNIT III Non Linear Data Structures - Trees.pptx
VISWANATHAN R V
 
PPTX
Introduction-to-Trees-in-Data-Structures-and-Algorithms[1].pptx
skhacharia305
 
PDF
Tree
maamir farooq
 
PPTX
9e28d06f-bae9-487e-8360-0e2c0a8c2972.pptx
alagark070605
 
PPTX
4. Apply data structures such as arrays, linked lists, and trees as an abstra...
deivasigamani9
 
Binary search tree in data structures
chauhankapil
 
Data- Structures-Binary-Search-Trees.pptx
selvi653915
 
Binary search tree definition operation.pptx
jeevananandk28
 
UNIT III Non Linear Data Structures - Trees.pptx
VISWANATHAN R V
 
Introduction-to-Trees-in-Data-Structures-and-Algorithms[1].pptx
skhacharia305
 
9e28d06f-bae9-487e-8360-0e2c0a8c2972.pptx
alagark070605
 
4. Apply data structures such as arrays, linked lists, and trees as an abstra...
deivasigamani9
 

Similar to binarysearchtreeindatastructures-200604055006 (1).pdf (20)

PDF
Makalah if2091-2011-020
Satria Ady Pradana
 
PPTX
UNIT III Non Linear Data Structures - Trees.pptx
kncetaruna
 
PPT
Algorithm and Data Structure - Binary Trees
donotreply20
 
PPTX
binary search tree
Halabja university - Kurdistan -Iraq
 
PPTX
Lec 10_Binary Search Tree in data structure and algorithm.pptx
hinamazhar6
 
DOCX
Biary search Tree.docx
sowmya koneru
 
PDF
Unit iv data structure-converted
Shri Shankaracharya College, Bhilai,Junwani
 
PPTX
lecture on introduction to Binary Search Tree
JayfTayuanMangansaka
 
PPTX
nptel 2nd presentation.pptx
KeshavBandil2
 
PPTX
Unit 5 Tree.pptx
SurajSharma266169
 
PPTX
Binary tree
Maria Saleem
 
PPTX
Trees data structure
Mahmoud Alfarra
 
PPT
Trees
9590133127
 
PDF
Binary search tree with pre-order inorder and postorder
VarshithaKolla
 
PDF
unit-2-dsa-tree introduction of tree and terninology
sayalijscoe2
 
PPTX
Index Structures.pptx
MBablu1
 
PPTX
Trees in data structure
Anusruti Mitra
 
PPTX
presentation 1 binary search tree in data structures.pptx
TayybaGhaffar1
 
PDF
PLEASE PLEASE use you own words, do not copy and paste !!!This is .pdf
Footageetoffe16
 
Makalah if2091-2011-020
Satria Ady Pradana
 
UNIT III Non Linear Data Structures - Trees.pptx
kncetaruna
 
Algorithm and Data Structure - Binary Trees
donotreply20
 
Lec 10_Binary Search Tree in data structure and algorithm.pptx
hinamazhar6
 
Biary search Tree.docx
sowmya koneru
 
Unit iv data structure-converted
Shri Shankaracharya College, Bhilai,Junwani
 
lecture on introduction to Binary Search Tree
JayfTayuanMangansaka
 
nptel 2nd presentation.pptx
KeshavBandil2
 
Unit 5 Tree.pptx
SurajSharma266169
 
Binary tree
Maria Saleem
 
Trees data structure
Mahmoud Alfarra
 
Trees
9590133127
 
Binary search tree with pre-order inorder and postorder
VarshithaKolla
 
unit-2-dsa-tree introduction of tree and terninology
sayalijscoe2
 
Index Structures.pptx
MBablu1
 
Trees in data structure
Anusruti Mitra
 
presentation 1 binary search tree in data structures.pptx
TayybaGhaffar1
 
PLEASE PLEASE use you own words, do not copy and paste !!!This is .pdf
Footageetoffe16
 
Ad

More from ajajkhan16 (20)

PPT
Unit-4 Cybercrimes-II Mobile and Wireless Devices.ppt
ajajkhan16
 
PPTX
SYMMETRIC CYPHER MODELS WITH SUITABLE DIAGRAM.pptx
ajajkhan16
 
PPTX
6. PRESENTATION REAL TIME OBJECT DETECTION.pptx
ajajkhan16
 
PPTX
mini project Presentation and details of the online plateforms.pptx
ajajkhan16
 
PPTX
first ppt online shopping website and all.pptx
ajajkhan16
 
PPTX
Presentation - Smart Vigilance System.pptx
ajajkhan16
 
PPTX
loundry app and its advantages Final ppt.pptx
ajajkhan16
 
PDF
hill cipher with example and solving .pdf
ajajkhan16
 
PPTX
data ebncryption standard with example.pptx
ajajkhan16
 
PPTX
block cipher and its principle and charateristics.pptx
ajajkhan16
 
PDF
searchengineAND ALL ppt-171025105119.pdf
ajajkhan16
 
PPTX
CRAWLER,INDEX,RANKING AND ITS WORKING.pptx
ajajkhan16
 
PPTX
STACK 20 INTERVIEW QUESTIONS and answers for interview.pptx
ajajkhan16
 
PPTX
RQP reverse query processing it's application 2011.pptx
ajajkhan16
 
PPTX
search engine and crawler index ranking .pptx
ajajkhan16
 
PPTX
NoSQL 5 2_graph Database Edited - Updated.pptx.pptx
ajajkhan16
 
PPT
Programming in python and introduction.ppt
ajajkhan16
 
PDF
STORMPresentation and all about storm_FINAL.pdf
ajajkhan16
 
PDF
39.-Introduction-to-Sparkspark and all-1.pdf
ajajkhan16
 
PPTX
21-RDF and triplestores in NOSql database.pptx
ajajkhan16
 
Unit-4 Cybercrimes-II Mobile and Wireless Devices.ppt
ajajkhan16
 
SYMMETRIC CYPHER MODELS WITH SUITABLE DIAGRAM.pptx
ajajkhan16
 
6. PRESENTATION REAL TIME OBJECT DETECTION.pptx
ajajkhan16
 
mini project Presentation and details of the online plateforms.pptx
ajajkhan16
 
first ppt online shopping website and all.pptx
ajajkhan16
 
Presentation - Smart Vigilance System.pptx
ajajkhan16
 
loundry app and its advantages Final ppt.pptx
ajajkhan16
 
hill cipher with example and solving .pdf
ajajkhan16
 
data ebncryption standard with example.pptx
ajajkhan16
 
block cipher and its principle and charateristics.pptx
ajajkhan16
 
searchengineAND ALL ppt-171025105119.pdf
ajajkhan16
 
CRAWLER,INDEX,RANKING AND ITS WORKING.pptx
ajajkhan16
 
STACK 20 INTERVIEW QUESTIONS and answers for interview.pptx
ajajkhan16
 
RQP reverse query processing it's application 2011.pptx
ajajkhan16
 
search engine and crawler index ranking .pptx
ajajkhan16
 
NoSQL 5 2_graph Database Edited - Updated.pptx.pptx
ajajkhan16
 
Programming in python and introduction.ppt
ajajkhan16
 
STORMPresentation and all about storm_FINAL.pdf
ajajkhan16
 
39.-Introduction-to-Sparkspark and all-1.pdf
ajajkhan16
 
21-RDF and triplestores in NOSql database.pptx
ajajkhan16
 
Ad

Recently uploaded (20)

PPT
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
PDF
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PDF
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
PDF
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
PPTX
sunil mishra pptmmmmmmmmmmmmmmmmmmmmmmmmm
singhamit111
 
PDF
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
PDF
Construction of a Thermal Vacuum Chamber for Environment Test of Triple CubeS...
2208441
 
PPTX
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PPTX
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
PPTX
Inventory management chapter in automation and robotics.
atisht0104
 
PPTX
Tunnel Ventilation System in Kanpur Metro
220105053
 
PPTX
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
PPTX
quantum computing transition from classical mechanics.pptx
gvlbcy
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
sunil mishra pptmmmmmmmmmmmmmmmmmmmmmmmmm
singhamit111
 
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
Construction of a Thermal Vacuum Chamber for Environment Test of Triple CubeS...
2208441
 
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
Inventory management chapter in automation and robotics.
atisht0104
 
Tunnel Ventilation System in Kanpur Metro
220105053
 
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
quantum computing transition from classical mechanics.pptx
gvlbcy
 
Zero Carbon Building Performance standard
BassemOsman1
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 

binarysearchtreeindatastructures-200604055006 (1).pdf

  • 1. Introduction  A binary search tree is a useful data structure for fast addition and removal of data.  It is composed of nodes, which stores data and also links to upto two other child nodes.  It is the relationship between the leaves linked to and the linking leaf, also known as the parent node, which makes the binary tree such an efficient data structure.
  • 2. Cont…  For a binary tree to be a binary search tree, the data of all the nodes in the left sub-tree of the root node should be less than the data of the root.  The data of all the nodes in the right subtree of the root node should be greater than equal to the data of the root.  As a result, the leaves on the farthest left of the tree have the lowest values, whereas the leaves on the right of the tree have the greatest values.
  • 4. Insertion in a BST  To insert data into a binary tree involves a function searching for an unused node in the proper position in the tree in which to insert the key value.   The insert function is generally a recursive function that continues moving down the levels of a binary tree until there is an unused leaf in a position which follows the following rules of placing nodes.
  • 5. Cont..  Compare data of the root node and element to be inserted.  If the data of the root node is greater, and if a left subtree exists, then repeat step 1 with root = root of left subtree. Else,  Insert element as left child of current root.
  • 6. Cont..  If the data of the root node is greater, and if a right subtree exists, then repeat step 1 with root = root of right subtree.  Else, insert element as right child of current root.
  • 8. Assignment  Explain Binary Search Tree in data structure with suitable example and discuss basic operation.