练习:敲打代码

@冒泡排序

void psort(int a[], int len);

@快速排序

void qsort(int a[], int len);

@选择排序

void ssort(int a[], int len);

@插入排序

void isort(int a[], int len);

@堆排序

void hsort(int a[], int len);

@希尔排序

void xsort(int a[], int len);

@归并排序

void msort(int a[], int len);

@链表基础操作

Node* createList(int len);
Node* createList(int a[], int len);
void destroyList(Node* head);
Node* pushNode(Node* head, int num) ;
Node* insertNode(Node* head, int pos, int num) ;
void deleteNode(Node* head, int pos) ;
Node* deleteNode(Node* head, int num) ;
Node* modifyNode(Node* head, int src, int dst) ;
Node* mergeList(Node* h1, Node* h2) ;
int listCount(Node* head) ;

@二分查找

int biSearch(int a[], int len);

@链表翻转

Node* revertList(Node* head)

@链表中第K个节点

@Node* findKNode(Node* head, int k);

@链表中倒数第K个节点

Node* findKNode(Node* head, int k);

@合并两个排序链表

Node* mergeList(Node* h1, Node* h2);

@复杂链表的复制

Node* cloneList(Node* head);

@链表中环的入口

Node* cirList(Node* head);

@删除链表中重复的节点

Node* delDupNode(Node* head);

@两个链表的第一个公共节点

Node* firstComNode(Node* h1, Node* h2);

@大数相加

std::string addBig(const std::string& num1, const std::string& num2);

@大数相减

std::string subBig(const std::string& num1, const std::string& num2);

@大数相乘

std::string multiBig(const std::string& num1, const std::string& num2);

@求最大公约数

int findGCD(int num1, int num2);

@求最小公倍数

int findLCM(int num1, int num2);

@数值的整数次方

double power(double base, int exp);

@二叉树前序遍历(递归+非递归)

std::vector<int> preOrder(TreeNode* root)

@二叉树中序遍历(递归+非递归)

std::vector<int> midOrder(TreeNode* root)

@二叉树后续遍历(递归+非递归)

std::vector<int> postOrder(TreeNode* root)

@二叉树层序遍历(递归+非递归)

std::vector<int> levelOrder(TreeNode* root)

@已知前序中序(或前序后续,或中序后序)重建二叉树

TreeNode* rebuild(std::vector<int> vec1, std::vector<int> vec2);

@二叉树镜像

TreeNode* mirror(TreeNode* root);

@二叉树的深度

int depth(TreeNode* root);

@二叉树中和为某一数值的路径

std::vector<std::vector<int>> findPath(TreeNode* root, int num);

@中序(或前序,或后序)二叉树的下一个节点

TreeNode* findNext(TreeNode* root)

@判断是否为对称二叉树

bool isMirror(TreeNode* root);

@替换空格为123

std::string replaceSpace(int a[]);

@数组中出现次数不超过一半的数字

int findNum(std::vector<int> nums);

@最小的k个数

std::vector<int> findKNums(std::vector<int> nums, int k);

@单词的个数

int wordsCount(std::string str);

@找出所有的单词

std::vector<std::string> allWords(std::string str);

@翻转单词序列

std::string reverseWords(std::string str);

@5个扑克牌顺子,大小王为0

bool isStraight(std::vector<int>);

@约瑟夫环

int LastRemaining(int n, int m);

@与或非异或

不使用其他变量交换两个整数

@字符串转换为整数

int str2Int(std::string str);

@strcpy实现

char* strcpy(char* des, const char* src)

@strlen实现

int strlen(const char* str);

@strcat实现

char* strcat(char* des, const char* src);

@strcmp实现

int strcmp(const char *s1,const char *s2);

@数组中重复数字

int dupNum(std::vector<int> nums);

@字符流中第一个不重复的数字

int firstNotDup(std::vector<int> nums);

@全排列

std::vector<std::string> permutation(std::string str);

@LCS算法-最长公共子序列

std::string findStr(std::string s1, std::string s2);

@LCS算法-最长公共子串

std::string findStr(std::string s1, std::string s2);

@斐波那契数列(递归+非递归迭代)

int fi(int n);

@判断是否回文串

bool isPalindrome(std::string str);

@求最长回文子串

bool maxPalindrome(std::string str);

@寻找和为定值的两个数

std::vector<int> findNums(std::vector<int> vec)

@hash算法

@括号匹配{}

@波兰式

@逆波兰式

@接雨水问题

@最大直方图矩形面积

@图的遍历-广度优先算法BFS

@图的遍历-深度优先算法DFS

@8皇后问题

@101-200之间的素数个数并打印

@正整数分解质因数

@递归求和

@递归求阶乘n!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值