What is the best data structure (container) for fast element insertion/deletion by index? -


What is the best data structure for fast element entry / deletion by an index?

You receive o (log n) performance using a binary tree with a node structure like this Can:

  Structure node & lieutenant; T & gt; The T Value Node will have the number of nodes in the left right right_count end of the left_count node in the right int_count end  

left_count value in the left And likewise, for the right side, the lookup will be performed by starting from the top of the tree and comparing it with the left and right calculations of the desired index value below. Insertion and deletion will be done using the normal binary tree algorithm, with appropriate adjustments for counting values.

This type of tree probably has a name; Appreciate more information!


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -