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

质数

相关推荐
U-52184F6915 分钟前
C++ 实战:构建通用的层次化数据模型 (Hierarchical Data Model)
开发语言·c++
charlie11451419125 分钟前
深入解构:MSVC 调试机制与 Visual Studio 调试器原理
c++·ide·windows·学习·visual studio·调试·现代c++
Trouvaille ~26 分钟前
【C++篇】把混沌映射成秩序:哈希表的底层哲学与实现之道
数据结构·c++·stl·哈希算法·散列表·面向对象·基础入门
肆悟先生30 分钟前
3.14 函数的参数传递
c++
wunianor1 小时前
[高并发服务器]DEBUG日志
linux·运维·服务器·c++
fab 在逃TDPIE1 小时前
Sentaurus TCAD 仿真教程(十)
算法
天赐学c语言1 小时前
12.19 - 买卖股票的最佳时机 && const的作用
c++·算法·leecode
菜鸟233号1 小时前
力扣78 子集 java实现
java·数据结构·算法·leetcode
yesyesyoucan1 小时前
在线魔方解谜站:从零入门到精通的智能魔方学习平台
学习·算法
Han.miracle1 小时前
数据结构与算法--008四数之和 与经典子数组 / 子串问题解析
数据结构·算法