Can we use AVL tree for this, so that root element is the median at any point
No, AVL-trees are height-balanced, you need a weight-balanced tree.