Re: data structure

I know I have to use AVL principles of rotation, but since text books
explain only for binary trees

Then you’re not looking in the right text books. See for example the
classic
Sedgewick “Algorithms” book.

The following reading may be useful:

http://www.catb.org/~esr/faqs/smart-questions.html#homework