【找工作】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

质数

相关推荐
dialect_2 小时前
KMP算法
开发语言·c++·算法
reikocao2 小时前
卡尔曼滤波的动态机制:P如何改变融合权重
算法
漂流瓶jz3 小时前
UVA-1612 猜名次 题解答案代码 算法竞赛入门经典第二版
数据结构·算法·题解·排序·aoapc·算法竞赛入门经典
吞下星星的少年·-·4 小时前
Div.2 CF 1130B题(构造,贪心)
算法·贪心·构造
ShineWinsu4 小时前
对于Qt:QRadioButton常见属性以及QButtonGroup的解析
数据库·c++·qt·microsoft·gui·qradiobutton·qbuttongroup
傲世仙尊4 小时前
多态-虚表才活到运行期符号表早已消失
c++
chenbingjie_c5 小时前
C++ 多态完全指南:从虚函数重写到虚函数表原理
开发语言·c++
是main不是漫5 小时前
【双指针——移动零】数组划分类题目的入门基石
c++·算法
·present·5 小时前
CSAPP(Bomb lab)
c语言·c++
王老师青少年编程5 小时前
2026年信奥赛c++普及组csp-j第二轮复赛真题
c++·真题·csp·信奥赛