Https://ide.codingblocks.com/s/321555

Sir, what is wrong with my code?

the way by which you are building the tree is not mention in question
in question it is not said to make the balanced tree
you just have to insert the data into tree one by one

no need to sort the array