STL deque based tree versus native binary tree implementation?

This Continuation Is the binary tree list implementation scalable?

What could be the advantages or disadvantages of implementing a tree using a linear array (stl vector) or stl deque

and not a binary tree with separate nodes having left and right pointers?

assumptions: the tree will be precomputed and will not be modified after its creation and will be used only for search.

+3
source share
2 answers

Well, I would say one of this:

  • , , std::vector ( ).
  • std::vector, . . , , , , , -,
  • , . malloc -euqivalent. ( , , C, C++, , std::vector).
  • std::vector.reserve() . , , , , malloc - , .
  • ,
+2

( std::vector) , , .

vector. ( ) , .

( , , ++ .)

+2

All Articles