I was trying to solve [this](https://www.spoj.com/problems/ORDERSET/) problem using AVL tree, but getting RE. Can't find out what I'm doing wrong. Can someone help me ??↵
↵
Solution — https://ideone.com/l7a0jg↵
↵
**UPDATE**↵
↵
Got AC. The bug was I was accessing directly root->subtree_size without checking if the root is NOT NULL.↵
↵
Solution — https://ideone.com/l7a0jg↵
↵
**UPDATE**↵
↵
Got AC. The bug was I was accessing directly root->subtree_size without checking if the root is NOT NULL.↵