0
I know the theory of binary trees, I have already implemented a stroke in C. I understand the functioning and applications of it when developed dynamically. However, a teacher asked me to develop a binary tree in vector, I did it perfectly only I can not identify a utility or advantage for this type of specific structure.
Depending on how it is implemented, it may not even be actually making a binary tree. It may be that you are just simulating memory with it and in fact are using pointers created by you to implement. I wanted to see this implementation to see if it’s still a tree in fact and if it is, if it’s not just an extra layer on something unnecessary.
– Maniero
One of the greatest advantages of an array is direct access. On this, take a look at Heaps, which are binary trees of maximum and minimum, very well implemented with vectors, due to the way it is organized. If you like, search for Heapsort, a sort algorithm using this structure.
– Gabriel Pellegrino