08 2020 档案

摘要:首先插入排序:(本文定义有序从小到大) 1)直接插入排序: 例如:如果数组大小为1,该数组必然有序,现在插入一个数据 可以看到此时此时该数组已经无序,将74记录下来,现在开始遍历之前有序的数组,83比74大,用84覆盖74,有序序列遍历完毕,把74放在原来84的位置,得到有序序列 现在看数组下一个元 阅读全文
posted @ 2020-08-24 21:07 kalice 阅读(168) 评论(0) 推荐(0) 编辑
摘要:British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- tha 阅读全文
posted @ 2020-08-18 18:37 kalice 阅读(145) 评论(0) 推荐(0) 编辑
摘要:The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program t 阅读全文
posted @ 2020-08-13 23:13 kalice 阅读(201) 评论(0) 推荐(0) 编辑
摘要:It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if y 阅读全文
posted @ 2020-08-13 09:37 kalice 阅读(173) 评论(0) 推荐(0) 编辑
摘要:首先构造cmp比较函数或结构体,再用一个vector容器将map转换为vector,最后用sort进行排序。 bool cmp(const pair<string, int> &a, const pair<string, int> &b)//也可以用结构体 { return a.second > b 阅读全文
posted @ 2020-08-13 07:12 kalice 阅读(1475) 评论(0) 推荐(0) 编辑
摘要:一道题目:已知了二叉树的先序遍历序列求该二叉树的个数。 刚开始,看了半天不知道说什么,于是写了一遍先序遍历的代码: while(p||!stack.empty()){ if(p){ visit(p); push(stack,p); p=p->lchild; } else{ pop(stack,p); 阅读全文
posted @ 2020-08-08 10:11 kalice 阅读(396) 评论(0) 推荐(0) 编辑
摘要:wpl指的是树的带权路径长度,是所有叶节点的权值乘以叶节点的深度之和,WPL=∑(叶节点的权值)*(叶节点的深度) #include<iostream> using namespace std; const int MAXSIZE=0x0000ffff; struct BiTree{ int wei 阅读全文
posted @ 2020-08-07 12:48 kalice 阅读(1032) 评论(0) 推荐(0) 编辑
摘要:首先明确线索二叉树的概念,线索二叉树是原本二叉树n个节点中未分配的n-1个孩子指针改为线索指针,左孩子指向前驱结点,右孩子指向后继节点。 中序线索二叉树的构造就要明确中序遍历: #include<iostream> using namespace std; struct BiTree{ int da 阅读全文
posted @ 2020-08-06 11:50 kalice 阅读(609) 评论(0) 推荐(0) 编辑
摘要:This time, you are supposed to find A+B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occu 阅读全文
posted @ 2020-08-03 11:07 kalice 阅读(420) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示