Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
It's a little unclear what you need it for. If this is a training code, then write in a student way. In production code, I would use proven features as much as possible. The array is std::vector, the sort tree is std::set/std::map.
A balanced ordered binary tree needs a key by which it orders. There are two options.
1. Key - something with a natural comparison, for example, int. Then std::map<int, std::vector<int> >
.
2. The key is the same array. Then std::set<std::vector<int> >
. (In the previous version, I explicitly wrote a comparison mechanism, it turns out that it already exists and you don’t need to write anything!)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question