Assignment 3 (YKPT 22181) (CS 301) (Section A)
Assignment 3 (YKPT 22181) (CS 301) (Section A)
YKPT-22181
Sem-IV(A)
Assignment-3
Write the difference of the following tree structures:
Key Differences
Binary Search Tree: Each node has at most two children with a specific ordering property.
Quad Tree
A Quad Tree is a tree data structure in which each internal node has exactly four
children. It is commonly used to partition a two-dimensional space by recursively
subdividing it into four quadrants or regions. Each node in a Quad Tree represents a
quadrant of the space it is partitioning. The tree is typically balanced to some extent, as
each subdivision results in four new nodes, but it can become imbalanced depending on the
distribution of the data. Leaf nodes contain data or pointers to data representing the
smallest subdivisions.
Binary Tree
A Binary Tree is a tree data structure in which each node has at most two children, referred
to as the left child and the right child. The shape of a Binary Tree can vary widely; it can be
balanced or imbalanced. There is no inherent order in the nodes of a general Binary Tree, so
traversal methods (preorder, inorder, postorder) are used to process nodes.
A Binary Search Tree is a type of Binary Tree. The defining characteristic of a binary search
tree is this: A node’s left child must have a key less than its parent, and a node’s right child
must have a key greater than or equal to its parents. BSTs maintain a specific order, which
allows for efficient searching, insertion, and deletion operations. Traversal methods
(especially inorder traversal) can be used to retrieve data in a sorted order.