【找工作】C++和算法复习(自用)

文章目录

自用随便记录

C++

排序

stl

头文件

全能头文件:

复制代码
#include<bits/stdc++.h>

自定义排序函数

复制代码
bool compare(const int &odd1,const int &odd2)
{
	return odd1>odd2;
}

stl

枚举map

c++ 复制代码
  map<int, string> mapStudent;  
  mapStudent.insert(pair<int, string>(1, "student_one"));  
  mapStudent.insert(pair<int, string>(2, "student_two"));  
  mapStudent.insert(pair<int, string>(3, "student_three"));  
  map<int, string>::reverse_iterator  iter;  
  for(iter = mapStudent.rbegin(); iter != mapStudent.rend(); iter++)  
  {  
     cout<<iter->first<<"   "<<iter->second<<endl;  
  }  

优先队列

算法

数据结构

树状数组

数学

快速幂

gcd和最小公倍数(ab的最小公倍数=ab/gcd(ab))

c 复制代码
int gcd(int x, int y){
    if(x<y) return gcd(y, x);
    return y == 0?x:gcd(y, x%y);
}

ex_gcd

质数

相关推荐
wqfhenanxc2 分钟前
Mixing C++ and Rust for Fun and Profit 阅读笔记
c++·笔记·rust
R-G-B5 分钟前
【MFC】 VS2022打开低版本的MFC,双击.rc文件,DIalog加载失败,页面弹窗fatal error RC***:cannot open*****
c++·mfc·vs打开较早版本mfc·双击.rc文件·dialog加载失败·fatal error rc·cannot open
敲上瘾7 分钟前
基于Tcp协议的应用层协议定制
linux·运维·服务器·网络·c++·网络协议·tcp/ip
莹莹学编程—成长记1 小时前
string的模拟实现
服务器·c++·算法
喵先生!4 小时前
C++中的vector和list的区别与适用场景
开发语言·c++
xMathematics5 小时前
计算机图形学实践:结合Qt和OpenGL实现绘制彩色三角形
开发语言·c++·qt·计算机图形学·cmake·opengl
ShiinaMashirol6 小时前
代码随想录打卡|Day27(合并区间、单调递增的数字、监控二叉树)
java·算法
yuanManGan7 小时前
C++入门小馆: 深入了解STLlist
开发语言·c++
梁下轻语的秋缘7 小时前
每日c/c++题 备战蓝桥杯(P1049 [NOIP 2001 普及组] 装箱问题)
c语言·c++·学习·蓝桥杯
逐光沧海7 小时前
STL常用算法——C++
开发语言·c++