二叉树装同样多要几层
同样一百万条数据,二叉树要多少层?
运行下面这段程序:
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
long long n = 1;
int lv = 0;
while (n < 1000000) {
n *= 2;
lv++;
}
cout << lv << endl;
}
(本题用 g++ -std=c++17 -O0 编译。)
全部评论