Regarding the order of the tree

here my preoder is not printing can u pls check

Hey @ssmit_joshi please share your code :slight_smile:

You haven’t made a constructor in your class. Take reference from this code https://ide.codingblocks.com/s/366633

Your preorder function seems well, if it still not work. Do let me know :slight_smile:

bt what if we have to do without constructor tell me code of that

I don’t think so that We can do it without making constructor. It’s being used for that purpose only to assign value to same objects.

Moreover if you want to write clean code you should get used to use of constructor.

ok then if the same we want to do in c language how it can be it does snot have constructore so pls tell me that ode

In c language we will use struct instead of class code for that would be something like this https://www.geeksforgeeks.org/binary-tree-set-1-introduction/
Here see the difference of code in C++ & C

can u pls ans me so that i acn do without constructor also pls

But i already answered all your questions. Can you tell me the question which you want me to be answered?

If you are talking about this question then i have attached a link in which it’s shown how you can build tree in C & C++ both

See this link

BUT THATSAME WE ARE DOING IN C++ THEN IT SHOULD HAPPEN NA IT IS SAME AS C THEN WHY PREORDER IS NOT PRINTING

can u tell me that now it is not printing other postorder and inoreder also pls can u check

pls answer me so that i can do

why anyone is not responding regardong my doubt since 2 days