H
H
HaruAtari2015-12-06 10:53:36
Algorithms
HaruAtari, 2015-12-06 10:53:36

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

1 answer(s)
A
Armenian Radio, 2015-12-06
@HaruAtari

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 question

Ask a Question

731 491 924 answers to any question