E
E
Egor Telnov2019-10-22 19:28:15
C++ / C#
Egor Telnov, 2019-10-22 19:28:15

How to find the ordinal number of an element in a tree?

Hello. I need to find the ordinal of an element in a binary tree. The complexity of the algorithm should be log(n). And I stood up. As I understand it, the element numbers are what the number will be when traversing the tree. To do this, you need to traverse the entire tree, but then the complexity will be O (n). What do you think was meant by finding the serial number, and if I understood this condition correctly, then how can such an algorithm be implemented with a given complexity?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question