713美团模拟面试

说一说虚拟地址空间有哪些部分

https://www.nowcoder.com/questionTerminal/0241d99ea91d479a8019579e40056afd
内核空间+用户空间,多线程分支的时候,就有那个,读同写异

不能是虚函数的函数

构造函数:需要提前直接实例化
内联函数:编译期直接要用
普通函数(肺类成员函数):不能被继承
友元函数:不能被继承

C++11新特性

auto类型推导
declatype类型推导
四种cast类型转换
智能指针
try_catch抛出异常
lamada表达式

给定一棵二叉树,分别按照二叉树先序,中序和后序打印所有的节点。
class Solution {
public:
    /**
     * 
     * @param root TreeNode类 the root of binary tree
     * @return int整型vector<vector<>>
     */
    vector<vector<int> > threeOrders(TreeNode* root) {
        // write code here
        vector<vector<int>> res;
        order(root);
        res.push_back(pre);
        res.push_back(mid);
        res.push_back(end);
        return res;
    }
    
    void order(TreeNode* root){
        if(root==NULL) return;
        pre.push_back(root->val);
        order(root->left);
        mid.push_back(root->val);
        order(root->right);
        end.push_back(root->val);
    }
 
private:
    vector<int> pre;
    vector<int> mid;
    vector<int> end;
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值