double zuida(std::vector<double> vec) {
	std::vector<double> temp;
	for(int i = 0; i < vec.size(); i++)
		temp.push_back(vec[i]);
notend:
	if(temp.size() > 0) {
		if(temp.size() < 2) {
			double tmp = *(&temp[0]);
			return tmp;
		}
		else if(temp.size() >= 2) {
			double mini = temp[0];
			int ind = 0;
			for(int i = 0; i < temp.size(); i++)
				if(temp[i] < mini) {
					mini = temp[i];
					ind = i;
				}
			temp.erase(temp.begin() + ind);
			goto notend;
		}
	}
}

The beauty is that every case is the best (also worst) case!

By Anonymous, 2019-10-12 10:42:23