B. Stroustrup, the creator of C++, said that we should not try to reinvent the wheel but make use of the STL.
Since you are beginner there is no better way to waste your time inventing algorithms, writing binary trees....unless of course you want a Ph.D in CS...
Have a look at a sort function provided by the STL sort - C++ Reference
Have a look at the bottom where 2 other sort functions are mentioned. Learning when and how to use then would be worthwhile.