![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法学习笔记
记录学习过程中不懂的和难以理解的算法,以及所犯的错误
战神和他的文盲老父亲
保持好奇心,不断学习,追求知行合一、学以致用
展开
-
leetcode-99. Recover Binary Search Tree
The bst(binary search tree)'s inorder traverse is ascend. In the following solution, I created a assistant point to record current subtree’s root’s pre nodes in inorder traverse. The key point here is that exactly two nodes were swapped. which could result原创 2020-12-18 19:21:43 · 80 阅读 · 1 评论 -
哈夫曼树的建立
哈夫曼树的构造过程:1、用给定的n个权值{w1,w2,…,wn}构成n棵二叉树的初始集合F为{T1,T2,…,Tn},其中每棵树Ti中只有一个权值为wi的根节点,它的左右子树均为空;2、在F中选取两棵根节点权值最小的树作为新构造的二叉树的左右子树,新二叉树的根节点的权值为其左右子树的根节点权值之和;3、从F中删除选取的这两棵树,并把这两棵新的二叉树同样以升序排列加入到集合F中;4、重复2和...原创 2020-04-03 11:54:07 · 215 阅读 · 0 评论 -
蛇形字符串
#include"pch.h"#include<iostream>#include<cstdio>#include<string>#include<cstring>#include<vector>#include<ctype.h>#include<algorithm>using namespace ...原创 2020-02-20 22:39:59 · 533 阅读 · 0 评论 -
写代码的一些注意事项
使用比较老的开发工具的时候最好(){}这些成对的打好再写里面的代码。尽量用const关键字声明常量,const double pi = acos(-1.0);原创 2020-02-09 11:20:21 · 219 阅读 · 0 评论 -
vs2017中scanf报错的解决办法
参见https://docs.microsoft.com/zh-cn/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DZH-CN%26k...原创 2020-02-09 10:57:43 · 206 阅读 · 0 评论