From Trees chapter in PU/ Data Structure and Algorithm
Asked on 21 Jan, 2021
0
411 Views
If entries in a BST are duplicate, how should we construct the tree ?
Also add count data type like.Struct BST_node { int data, Int count, struct BST_node* left, *right } .
Also add count data type like.Struct BST_node { int data, Int count, struct BST_node* left, *right } .
Binary Search Tree are created to hold unique data entries. But if we need to keep duplicate entries, then there can be one strategy : - if (node->data == given_data), then given_data should be kept in the same node. This node should be linked with linked_list or extra pointer to hold duplicate entries.
Add your answer