Engineering & Technology
มหาวิทยาลัย
請問有沒有大神會翻成程式碼?
我看不懂
Sieve algorithm
1.1 What Is an Algorithm?
33
for p 2 to n do A[p] - P
for p < 2 to [n] do //see note before pseudocode
if A[p]+0 llp hasn't been eliminated on previous passes
jr p * P
while j < n do
A[j]0 //mark element as eliminated
j<j+ p
I/copy the remaining elements of A to array L of the primes
if( 0
for p + 2 to n do
if A[p] = 0
L[i] + A[p]
iki +1
return L
คำตอบ
ยังไม่มีคำตอบ
ข้อสงสัยของคุณเคลียร์แล้วหรือยัง?
เมื่อดูคำถามนี้แล้ว
ก็จะเจอคำถามเหล่านี้ด้วย😉