Added: 3 years ago
From: UCBerkeley
Views: 24,506
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (23)

Sign In or Sign Up now to post a comment!
  • 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..

  • 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?

  • @xwowsersx 9 isn't prime...

  • @spartanfry yea, i meant "but 9 ISN'T prime." Doesn't matter anyways...figured it long ago.

  • @xwowsersx Sorry about that, I did not notice this was posted a month ago until after I posted the comment.

  • @spartanfry no worries. just cuz it was a month ago, doesnt mean i wasnt still struggling. thanks!

  • 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.

  • I think what looks like a field, in many cases, is actually a call to a getter method. Otherwise, how else would it be able to perform any useful function (?) If my logic is flawed, I'd like to be corrected.

  • at around minute 2, it does not need to check all the numbers up until n, since the biggest divisor is always n/2, and this saves half the iterations on the while loop.

    Its really not a very good example to a while loop, since it could be done simply by a for cycle. While loops are usually applied when you don't really know how many iterations you will have.

  • Comment removed

  • Later in lecture he uses the sieve of Eratosthenes to implement a much faster way of finding a range of primes.

  • Comment removed

  • Comment removed

  • ROck on!!!!

  • extremely clear! Very interesting for students of Informatics.

  • 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!!

  • i saw that too, but the board was covering that extra divisor++ statement when he was writing the for loop...honestly, i don't know why he uses a chalkboard to write out all of his code anyway...

  • @skyflashings It makes a change to see someone that is prepared to spend their time writing it out by hand. If I did that, I would be non sensical becuase my writing is ass.

  • it looks like he left it in from when he did the while loop, you would need it there.

  • Doesn't the loop in the Pascal triangle method needs variables I and J for looping sake ?

Loading...
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more