Answer the question
In order to leave comments, you need to log in
Can a binary search tree have elements with the same value?
Good afternoon.
Tell me, can a binary search tree contain two elements with the same value? By definition, it can't. But how then to react in case of an attempt to add another element to it with a value that already exists?
Answer the question
In order to leave comments, you need to log in
Can not.
Therefore, the reaction to this action is an error message. How to respond to this message is up to the user of the tree.
In some cases, it may be convenient to simply ignore such elements.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question