码迷,mamicode.com
首页 > 其他好文 > 详细

Algorithms

时间:2015-06-11 06:57:38      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:

  1. Count prime numbers not exceeding n(n>0)
  2. Pseudocode:
    Input: an integer n > 1 Let A be an array of Boolean values, indexed by integers 2 to n, initially all set to true. for i = 2, 3, 4, ..., not exceeding √n: if A[i] is true: for j = i2, i2+i, i2+2i, i2+3i, ..., not exceeding n : A[j] := false Output: all i such that A[i] is true.

    The Sieve of Eratosthenes uses an extra O(n) memory and its runtime complexity is O(n log log n).

  3. d
  4. d
  5. d
  6. d
  7. d
  8. d
  9. d
  10. d
  11. d

Algorithms

标签:

原文地址:http://www.cnblogs.com/wade-case/p/4567929.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!