[go: up one dir, main page]

0% found this document useful (0 votes)
29 views38 pages

56 Data Structure

The document provides an overview of tree data structures, including AVL Trees, Red-Black Trees, and B-Trees, detailing their properties and balancing mechanisms. It also includes a series of questions related to tree types and traversal methods, specifically breadth-first search (BFS) and depth-first search (DFS). Additionally, it offers links to the Arora Educator's online platforms for further learning and connection.

Uploaded by

mdafsarurdu90
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views38 pages

56 Data Structure

The document provides an overview of tree data structures, including AVL Trees, Red-Black Trees, and B-Trees, detailing their properties and balancing mechanisms. It also includes a series of questions related to tree types and traversal methods, specifically breadth-first search (BFS) and depth-first search (DFS). Additionally, it offers links to the Arora Educator's online platforms for further learning and connection.

Uploaded by

mdafsarurdu90
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

(BPSC + STET) Computer Science

Welcome Everyone Arora Educator


“Arora Educator” Official Platform
By : Sachin Arora Sir
Founder : AE (Arora Educator)
WhatsApp : 97 606 89 846
Arora Educator
Arora Educator : Stay Connected
YouTube Channel Link –
https://www.youtube.com/@AroraEducator/
Telegram Link –
https://t.me/AroraEducatorChannel
Instagram Link –
https://www.instagram.com/aroraeducator.official/
Arora Educator App Link –
https://play.google.com/store/apps/details?id=co.stan.xsjqp
Data Structure Arora Educator
Arora Educator
Topic : Trees

✓ Non-linear data structure


Few more Tree = Arora Educator

1) AVL Tree
2) Red Black Tree
3) B Tree = Self Balanced Tree
AVL Tree Arora Educator
✓ AVL stands for = Adelson-Velsky and Landis =
Inventors of the AVL tree
✓ AVL tree is a self-balancing binary search tree
(BST) that automatically rotates and maintains
balance.
✓ AVL tree may perform the following four kinds of
rotations –
a) Left rotation
b) Right rotation
c) Left-Right rotation
d) Right-Left rotation
AVL Tree Arora Educator
AVL Tree Arora Educator
Red Black Tree Arora Educator
✓ RB tree was invented in 1972 by Rudolf
Bayer.
✓ A red-black tree is a kind of self-
balancing binary search tree.
✓ It uses a simple color-coding scheme
Red Black Tree : rule Arora Educator

✓ Root = Always Black


✓ Node = Red/Black
✓ Red Color = Red nodes
cannot have red children
✓ Red Color = no two
consecutive red nodes on
any path
B Tree Arora Educator
✓ B-Tree was developed in the year 1972 by
Bayer and McCreight
✓ B-Tree is a self-balanced search tree
✓ B-tree is a fat tree
✓ Here every node contains multiple keys and
has more than two children
Q.1. A tree where every node has either zero or two
children is called.? Arora Educator
1) Full Binary Tree
2) Complete Binary Tree
3) Perfect Binary Tree
4) Degenerate Binary Tree
5) Balanced Binary Tree
Q.2. A tree where every internal node has exactly two
child nodes and all the leaf nodes are at the same level
is called.? Arora Educator
1) Full Binary Tree
2) Complete Binary Tree
3) Perfect Binary Tree
4) Degenerate Binary Tree
5) Balanced Binary Tree
Q.3. A tree whose left and right subtrees' heights differ
by not more than 1 is called.? Arora Educator
1) Full Binary Tree
2) Complete Binary Tree
3) Perfect Binary Tree
4) Degenerate Binary Tree
5) Balanced Binary Tree
Q.4. A tree where all nodes have either only a left child
or only a right child is called.? Arora Educator
1) Full Binary Tree
2) Complete Binary Tree
3) Perfect Binary Tree
4) Degenerate Binary Tree
5) Balanced Binary Tree
Q.5. A tree where all levels are filled with nodes,
except possibly the last level is called.? Arora Educator
1) Full Binary Tree
2) Complete Binary Tree
3) Perfect Binary Tree
4) Degenerate Binary Tree
5) Balanced Binary Tree
Q.6. A tree that self-balance and rotate automatically
are known as.? Arora Educator
1) Full Binary Tree
2) Complete Binary Tree
3) B Tree
4) Red Black Tree
5) AVL Tree
Q.7. A Balanced Binary Search Trees with two coloured
nodes are known as.? Arora Educator
1) Full Binary Tree
2) Complete Binary Tree
3) B Tree
4) Red Black Tree
5) AVL Tree
Q.8. A Tree where every node contains multiple keys
are known as.? Arora Educator
1) Full Binary Tree
2) Complete Binary Tree
3) B Tree
4) Red Black Tree
5) AVL Tree
Q.9. In the ______ tree, a node can have either 0 or
maximum n number of nodes.? Arora Educator
1) Binary Tree
2) Binary Search Tree
3) Balanced Tree
4) General Tree
5) All of these
Q.10. In a _______ tree, each node in a tree can have
utmost two child nodes.? Arora Educator
1) Binary Tree
2) Binary Search Tree
3) Balanced Tree
4) General Tree
5) All of these
Q.11. In a Binary Tree utmost 2 child nodes means.?
Arora Educator
1) Only 2 Nodes
2) Only 0 Nodes
3) Only 1 Nodes
4) More than 2 Nodes
5) 0,1,2 Nodes
Q.12. In this tree, left nodes contain lesser value than
root node & right nodes contain more value than root
node.? Arora Educator
1) General Tree
2) AVL Tree
3) Red Black Tree
4) Binary Tree
5) Binary Search Tree
Q.13. This tree obeys the binary search tree as well as a
balancing factor.? Arora Educator
1) AVL Tree
2) Red Black Tree
3) B tree
4) Extended Tree
5) All of these
Q.14. In AVL Tree balancing factor's value must be.?
1) 0 Arora Educator
2) -1
3) 1
4) All of these
5) None of these
Q.15. A Degenerate Binary Tree, also known as a.?
1) Pathological Tree Arora Educator
2) Left Skewed Tree
3) Right Skewed Tree
4) All of these
5) None of these
Arora Educator
Topic : Tree Traversal
✓ Tree traversal, also known as = tree Arora Educator
search.
✓ It is a process of = visiting each node of
a tree data structure.
✓ Visit each node of a tree = exactly once
Arora Educator
Tree Traversing
✓ Traversing in a tree is done by
breadth first search(BFS) and depth
first search (DFS)
Arora Educator
1. BFS = Breadth First search
✓ Level order traversal
✓ BFS uses Queue data structure(FIFO)
to perform operations.
Arora Educator
BFS = Breadth First search
Arora Educator
BFS = Breadth First search
1
23
45
Ans = 12345
Arora Educator
BFS = Breadth First search
1
25
34
Ans = 12534
Arora Educator
BFS = Breadth First search
1
27
3 6 8 10
459

Ans = 1 2 7 3 6 8 10 4 5 9
Arora Educator
2. DFS = Depth First search
✓ Depth First search is implemented by
using stack data structure
Arora Educator
Topic : DFS Tree Traversal
✓ Traversing a tree means visiting every
node in the tree.
✓ 3 Types of DFS Tree Traversal
▪ Pre order traversal
▪ In order traversal
▪ Post order traversal
Types of DFS Tree Traversal Arora Educator
▪ Pre order traversal = Root Left Right = ABC
▪ In order traversal = Left Root Right = BAC
▪ Post order traversal = Left Right Root = BCA
Arora Educator
Arora Educator : Stay Connected
YouTube Channel Link –
https://www.youtube.com/@AroraEducator/
Telegram Link –
https://t.me/AroraEducatorChannel
Instagram Link –
https://www.instagram.com/aroraeducator.official/
Arora Educator App Link –
https://play.google.com/store/apps/details?id=co.stan.xsjqp

You might also like