C++ data structure for text editor


I am writing a c++ implementation for text editor for the below operatios

1) create an empty text
2) insert a line before the particular line no
3) delete a line with given index
4) finding the number of lines.

I want to use a BST or AVL tree for the above operations with key as number of the line and char * as value to which points to character text

i have inserted 10 lines
now i want to insert a line before 2 .
then i need to re number all the lines above 2 .
does this operation can be peformed in efficent way ??
can we increase the keys of all leaves above a certain key with out visiting more than logn nodes ?

can any one suggest ??


Topic archived. No new replies allowed.