std::set is a sorted tree. It provides begin and end methods so I can get minimum and maximum and lower_bound and u
std::set
begin
end
lower_bound
u
It's going to be O(size) to get the middle of a binary search tree. You can get it with std::advance() as follows:
std::advance()
std::set::iterator it = s.begin(); std::advance(it, s.size() / 2);