0% found this document useful (0 votes)
14 views3 pages

DS Saq 5

The document discusses different types of trees such as binary trees, binary search trees, and AVL trees. It lists some common applications of trees like binary search trees, expression trees, and syntax trees. The advantages mentioned are efficient searching, ordered data representation, and versatility, while disadvantages include complexity, memory consumption, balancing issues, and traversal overhead.

Uploaded by

abinashreddy792
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)
14 views3 pages

DS Saq 5

The document discusses different types of trees such as binary trees, binary search trees, and AVL trees. It lists some common applications of trees like binary search trees, expression trees, and syntax trees. The advantages mentioned are efficient searching, ordered data representation, and versatility, while disadvantages include complexity, memory consumption, balancing issues, and traversal overhead.

Uploaded by

abinashreddy792
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/ 3

DATA STRUCTURES

NAME: K. ABINASH REDDY


CLASS: CSE-D
ROLL NO: AUU23EGCSE118

SHORT ANSWERS QUESTIONS

1. What is difference between graphs and trees?


Ans: Graph is a non−linear data structure that can have more than one path
between vertices. Tree is also a non−linear data structure, but it has only one path
between two vertices.

2. What are the different types of trees?


Ans: In data structures, trees are classified based on their properties and
organization. Common types include binary trees, where each node has at most
two children; binary search trees, ensuring left child is less than parent and right
child is greater; and AVL trees, self-balancing to maintain logarithmic height for
efficient operations.
3. What are the applications of trees?
Ans: 1. Binary Search Trees (BST): Efficient searching, insertion, and deletion
operations.
2. Expression Trees: Representing and evaluating expressions, especially
arithmetic expressions.
3. Binary Heap: Used in priority queues and heap sort algorithms.
4. Syntax Trees: Representing the syntax of expressions or programming
languages.
5. File System Indexing: Representing hierarchical file structures for efficient
searching and traversal.
6. Huffman Coding: Data compression technique based on tree representation of
characters.
7. Decision Trees: Used in decision-making processes and algorithms like ID3
(Iterative Dichotomiser 3).
These applications demonstrate the flexibility and utility of trees in various
computing contexts.

4. What are the advantages and disadvantages of trees?


Ans: Advantages:

1. Efficient Searching: Trees, especially balanced ones like AVL and Red-Black
trees, offer efficient searching operations.
2. Ordered Data: Binary Search Trees maintain order, useful for operations that
require sorted data.
Hierarchical Representation: Ideal for representing hierarchical relationships, like
file systems or organization charts.
3. Versatility: Trees can be used in various applications, from data storage to
algorithm design.

Disadvantages:
1. Complexity: Implementing and managing tree structures can be complex,
especially for balanced trees.
2. Memory Consumption: Trees can consume more memory compared to simpler
data structures like arrays or linked lists.
3. Balancing: Balanced trees require additional operations for balancing, which
can affect performance.
4. Traversal Overhead: Traversing trees can be slower compared to linear data
structures for certain operations.
Understanding these pros and cons helps in choosing the right data structure for
specific programming tasks.

5. What is a binary search tree?


Ans: In C, a binary search tree (BST) is a binary tree data structure where each
node has at most two children, referred to as the left child and the right child. The
key property of a BST is that the value of each node's left child is less than the
node's value, and the value of each node's right child is greater than the node's
value. This ordering property allows for efficient searching, insertion, and
deletion operations, making BSTs useful in many applications requiring sorted
data.

You might also like