![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法总结
Percy-BIT
这个作者很懒,什么都没留下…
展开
-
[the summarization of algorithm]How to list the prime number
In order to get the list of prime number, I find some ways to do that. 素数判定法: 1、朴素的方法: #include bool isprime(int n);//判断是否是质数的函数 int main() { int n; scanf("%d",&n); if(isprime(n)) printf原创 2013-12-31 20:48:29 · 571 阅读 · 0 评论 -
[the summarization of algorithm]Heap and Heapsort
1、什么是堆 1)堆是一个树,或完全二叉树,或近似完全二叉树。 (注:完全二叉树是指:若设二叉树的深度为h,除第 h 层外,其它各层 (1~h-1) 的结点数都达到最大个数,第 h 层所有的结点都连续集中在最左边的二叉树。) 2)堆需要满足这样的一个性质: 1.父结点的键值总是大于或等于(小于或等于)任何一个子节点的键值(大根堆/最大堆、小根堆/最小堆)。 (注:当父结点的键值总是大于或原创 2014-01-02 22:47:44 · 596 阅读 · 0 评论