Comments

You can combine walk on Segment tree or fenwick tree to be able to manage the indexes when deleted.