2020.3.30美团一面面试题

2020.3.30美团一面面试题:
1.数据结构–给定两个栈实现队列的存取元素

#include <bits/stdc++.h>
//#include <iostream>
//#include <stack>

using namespace std;

class Solution{
public:
    stack<int> stac1;
    stack<int> stac2;
    void mypush(int a){
        stac1.push(a);

    }
    
    void mypop(){
        if(stac1.empty() && stac2.empty())
            cout<<"队列为空"<<endl;//代表队列为空
        if(stac2.empty())
        {
            while(!stac1.empty())
            {
                int temp=stac1.top();
                stac2.push(temp);
                stac1.pop();
            }
        }
       cout<< stac2.top()<<endl;
       stac2.pop();
    }

};
int main() {
    //int a;
    //cin >> a;
    Solution s;
    s.mypush(1);
    s.mypush(2);
    s.mypop();
    s.mypush(3);
    s.mypop();
    s.mypop();
    return 0;
}

2.TCP/IP协议
a.TCP三次握手四次挥手–具体实现过程
三次握手: 注意客户端和服务端的状态变化
三次握手: 注意客户端和服务端的状态变化
四次挥手: 注意客户端和服务端的状态变化
四次挥手: 注意客户端和服务端的状态变化

3.HTTP的报文格式:
请求报文和响应报文
4.reactor模式
单reactor模式
多reactor模式
详情参考:
https://www.cnblogs.com/winner-0715/p/8733787.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值