You are going to write a computer program where the requirement of the data collection is that it should be kept in order and there will be a great deal of adding and deleting from the collection. What data structure would be best to model this?
I was thinking vector, but that’s not ordered. Any suggestions? I’m sure the answer is staring me in the face but looking through my notes I can’t find anything that clicks.
Any help with this would be greatly appreciated.
The classic answer to that is: a Tree. Simplest would be a binary search tree but you also might want to look for Red-Black trees or AVL trees. The boost graph library might also be a good starting point.