Unit 4

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

UNIT IV

2MARKS

1. Define tree?
Trees are non-liner data structure, which is used to store data items in a shorted sequence.
It represents any hierarchical relationship between any data Item. It is a collection of
nodes, which has a distinguish node called the root and zero or more non-empty sub trees
T1, T2,….Tk. each of which are connected by a directed edge from the root.

2. Define Height of tree?

The height of n is the length of the longest path from root to a leaf. Thus all leaves have
height zero. The height of a tree is equal to a height of a root.

3. Define Depth of tree?

For any node n, the depth of n is the length of the unique path from the root to node n.
Thus for a root the depth is always zero.

4. What is the length of the path in a tree?


The length of the path is the number of edges on the path. In a tree there is exactly one
path form the root to each node.

5. Define sibling?

Nodes with the same parent are called siblings. The nodes with common parents are
called siblings.

6. Define binary tree?

A Binary tree is a finite set of data items which is either empty or consists of a single
item called root and two disjoin binary trees called left sub tree max degree of any node is
two.

7. What are the two methods of binary tree implementation?

Two methods to implement a binary tree are,

a. Linear representation.

b. Linked representation

8. What are the applications of binary tree?

Binary tree is used in data processing.


a. File index schemes
b. Hierarchical database management system

9. List out few of the Application of tree data-structure?

Ø The manipulation of Arithmetic expression

Ø Used for Searching Operation

Ø Used to implement the file system of several popular operating systems

Ø Symbol Table construction

Ø Syntax analysis

10. Define expression tree?

Expression tree is also a binary tree in which the leafs terminal nodes or operands and
non-terminal intermediate nodes are operators used for traversal.

11. Define tree– traversal and mention the type of traversals?


Visiting of each and every node in the tree exactly is called as tree traversal.

Three types of tree traversal

1. Inorder traversal

2. Preoder traversal

3. Postorder traversal.

12. Define in -order traversal?

In-order traversal entails the following steps;

a. Traverse the left subtree

b. Visit the root node

c. Traverse the right subtree

13. Define threaded binary tree.

A binary tree is threaded by making all right child pointers that would normally be null
point to the in order successor of the node, and all left child pointers that would normally be null
point to the in order predecessor of the node.
14. What are the types of threaded binary tree?

i. Right-in threaded binary tree


ii. Left-in threaded binary tree
iii. Fully-in threaded binary tree
15. Define Binary Search Tree.

Binary search tree is a binary tree in which for every node X in the tree, the values of all the keys
in its left subtree are smaller than the key value in X and the values of all the keys in its right
subtree are larger than the key value in X.

16. What is AVL Tree?

AVL stands for Adelson-Velskii and Landis. An AVL tree is a binary search tree which has the
following properties:

1.The sub-trees of every node differ in height by at most one.

2.Every sub-tree is an AVL tree.


Search time is O(logn). Addition and deletion operations also take O(logn) time.

17. List out the steps involved in deleting a node from a binary search tree.

▪ Deleting a node is a leaf node (ie) No children


▪ Deleting a node with one child.
▪ Deleting a node with two Childs.

18. What is ‘B’ Tree?

A B-tree is a tree data structure that keeps data sorted and allows searches, insertions, and
deletions in logarithmic amortized time. Unlike self-balancing binary search trees, it is optimized
for systems that read and write large blocks of data. It is most commonly used in database and
file systems.

19. Define complete binary tree.

If all its levels, possible except the last, have maximum number of nodes and if all the nodes in
the last level appear as far left as possible
16 MARKS
1. Explain the AVL tree insertion and deletion with suitable example.
2. Describe the algorithms used to perform single and double rotation on AVL
tree.
3.Write short notes on
i. Binomial heaps
ii. Fibonacci heaps
4.Explain the tree traversal techniques with an example.
5.Construct an expression tree for the expression (a+b*c) + ((d*e+f)*g). Give the outputs
when you apply inorder, preorder and postorder traversals.
6. How to insert and delete an element into a binary search tree and write down the code for
the insertion routine with an example.
7. What are threaded binary tree? Write an algorithm for inserting a node in a threaded
binary tree.
8. Create a binary search tree for the following numbers start from an empty binary search
tree. 45,26,10,60,70,30,40 Delete keys 10,60 and 45 one after the other and show the trees at
each stage.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy