Public:
Vector
Vector
Level_binary (root, 0);
Return vec.
}
Void level_binary (root TreeNode * and an int level) {
If (root==NULL) {//recursive termination conditions
return ;
}
If (vec) size ()==level) vec. Resize (level + 1);
Vec [level] push_back (root - & gt; Val);
Level_binary (root - & gt; Left, level + 1);
Level_binary (root - & gt; Right, level + 1);
}
};
I want to ask why the vector of a two-dimensional array of first d: why do you want to use the resize