CS 61B Lecture 5: Iteration and Arrays I
Top Comments
All Comments (23)
-
Thank you Gentlemen;
{I will now go to have a wonder cup of English tea[]}
-
Arrays in java are objects...i agree of that... but where did they fit in the class hierarchy. any answer please..
-
@spartanfry no worries. just cuz it was a month ago, doesnt mean i wasnt still struggling. thanks!
-
@xwowsersx Sorry about that, I did not notice this was posted a month ago until after I posted the comment.
-
@spartanfry yea, i meant "but 9 ISN'T prime." Doesn't matter anyways...figured it long ago.
-
@xwowsersx 9 isn't prime...
-
Wrote out the Sieve of Eratosthenes by hand to work through the algorithm. I used a boolean array of size 11 and ran through it by hand. Can't seem to see where the loop sets 9 to be false. I was left with 4, 6, 8, 10 set to false, and 2, 3, 5, 7, and 9 set to TRUE. But 9 is prime, so what am I missing here?
-
good man with great knowledge......
-
8:34 his voice cracks =), what a great teacher this man is.
-
I performed the sieve prime example and set 'n' to ten and it printed out all primes up to ten. Is that the correct result? I'm a Flash programmer so I simply changed the syntax for AS3.0 and wrote a class. Unfortunately, I don't think you can actually create a Boolean array in AS (possibly as a 'rest array' as a function argument and set the return value as Boolean(?)), so I simply created an array and set it to true in the 'for' loop.



extremely clear! Very interesting for students of Informatics.
cristianigianni 2 years ago 12
He Made an error in 10:23 where he changes the IsPrime Method to use for Loop he forgot to Erase at the end the divisor++; because he has it in the for loop so it does not make sence to have divisor++; in the end of the program will not work like it suppose to!!
elcapino85 3 years ago 12