Thursday, March 24, 2011

Scope

Today we went over the efficiency of the fibonacci code. Even though it's short, it's really in-efficient since it calls itself a lot with higher inputs (over 2 million for an input of 30!).

We also learned about the scope of a program. Basically it's the perspective of the currently running code, or where your code searches for values. The rest of it pretty much went over my head.
The last thing we learned was that in java, arrays can be modified, but we can't immediately swap the values of two arrays.

P.S. - As we all know, we still have to do this weeks homework(i'm no exeption..) so get on it!!

Fibonacci

In class we learned that when you call the method reduce it changes the value of the array and the count but not the value of the len.

We also learned the fibonacci code and we did test preparation.

In the fibonacci code when using blue jay the computer recalculates the whole sequence to get the next value of the fibonacci code.

They add the first two index's to get the next index then recalculates all the index's to get the next sequence of the set.

Tuesday, March 22, 2011

Recursion and Palindromes

Today was a very confusing day for me in class at first.

Today in class we focused on continuing our lesson with recursion and palindromes. To take a problem and repeatedly reduce it to simpler problems is what is known as recursion.

The example we did in class today was our do now. It dealt with coming up with a recursion to tackle the problem of how many ears x amount of bunnies would have if each bunny has two ears. At first I was confused about this and wondered how I would tackle it. But I remembered that we did a recursion problem on Thursday and looked backed on it. This helped greatly which I encourage everyone to do. Look on pass examples.
Remember these three rules to be golden:
1.Find out how to take just one step.
2.Break each journey down into one step plus a smaller journey.
3.Know when to stop.
When you are learning to walk you must learn how to take your first step. When you set a goal to get somewhere as a child every step u take breaks your journey into a smaller step and less of a distance to cover. And when you reach where you are going you stop. Who wants to hit themselves walking into a table.


Towards the middle of the class we started tackling palindromes.
A man, a plan, a canal, Panama!
Read it backwards and yes its cool. This is what is known as a palindrome.
Our example Mr. Jacoby walked us through was to see how to find a palindrome of a string object. The link to the notes which can be found here shows the problem of seeing how we can find palindrome with the first three letters of the word hello. I found this very confusing and I am still eluded by the coding of this. But in essence what I grasp was a piece of code that checked if the letter was the same spelled forward and backward. For example BOB.
The last thing we tackle in class was the Maze. Or as i call it how can programmers do this because its amazing. A code that works it way through a maze. Although we didn't have a chance to go through it, Mr Jacoby showed us how it worked. The link provided shows us how the object going through the maze checks the first direction north and checks all directions if it can go.
This is the end of my first blog EVER. Hope I did alright and you guys find this informative.


recursion

just trying to blog

Well today was an interesting day because with that snowy rain and thats it 4 the day. this is my 1st time doin this so excuse me 4 messing up with anything.

What we learned in class today was about recursion, but it was at the last 10 minutes of class because all of us were doing the jumper project. From Mr. Jacoby recursion is a strategy for solving problems by
repeatedly reducing them to simpler problems.

For example: factorials
5! = 5 x 4!
4! = 4 x 3!
3! = 3 x 2!
2! = 2 x 1!
So from what i got the lower u go the more u can understand what is the answer.
Also that the repitition of it would eventually end it up being easier to do by that every time it recur it would repeat and then the simplest form and then from there go forwards then u should be able to get your answer.

Recursive problems are broken down into two cases

line 1. The base case: the simplest case where no computation is necessary.
line 2. The recursive case: everything else - brings us to closer to the base case. It simplifies or reduces the problem.

                        public int factorial(int n) {
line 1:                           if (n == 0) return 1;
line 2:                           return n * factorial(n ‐ 1);
                        }


All loops can be written recursively though its not a good idea! 

Tuesday, March 15, 2011

INTERFACES!!!

So today we learned about interfaces. We started off class with the do now, which was to explain how you "drive a car." The people who participated explain more in details what the driver does and not explaining about the kind of car. I really didn't get what he meant by that, but since there's different kind of cars they word differently? O.o
Interfaces is an area between 2 systems, where they interact with each other. This ties in with the do now because to drive a car you need two things, a driver and a car of course. They both work together, sorta,to make the car move.


Benefits of Interfaces
- each system works only on its itself and doesn't care about other systems
- they're all independent so its easier to use and more flexible, whatever that means.
There are certain things that interfaces can and can not do, which is all on the website so I won't bother re-writing it.
check it out!!!!! -----------> http://web.aprchs.net/jacoby/mj2x_2011
Another thing I can sorta explain more on is comparing interfaces.
ComparableInterface
It "marks" classes that are comparable, this means you can decide to sort objects in whichever way you want.
EX.
public int compareTo(T obj)
This is going to compare T to an object but using int O.o yea idk
the way I worte it is -int/<, 0/= and +int/>



ok, well im done now. hopefully I didn't confuse anybody! :)
and there's tutoring 4th & 8th for those who need help! be there or be square xD

Monday, March 14, 2011

computer science 3/14/11

HAPPY PI DAY :D


Today's lesson in APCS was based on the pi day contest that the whole school goes through held by all of our known math teacher's Levy, Jacoby, Reisman, and others.
From our class, Omar managed to memorize 93 digits of pi (for what I dont know -__- lolz).

We also installed Eclipse, which like Blue Jay, is another coding "environment" for java. To install Eclipse, all you have to do is unpack the zip file download in the directory you want. When you unzip the file, it creates a subdirectory called "eclipse", with other subdirectories under that.

We got our tests back today, and you're like me who failed, you shouldn't worry about it to much because Jacoby curved the grade. So, take the grade you got on your test and find the square root of that and times it by 10, and that is your grade. Still failed...well try harder next time. =D
teachers Pictures, Images and Photos

Tuesday, March 8, 2011

Test Review 2 plus some Blogspot fail

Well i started about, um an hours ago, and i was trying to post cause it was my turn. So basically i ended using Fern's account to post what i thought i learned today. -SANTIAGO!!!

Firstly, today was super brief (lucky me) and we were refreshed on how an ArrayList works.
for example in ArrayList named List... Do you know what
List.add(x) means?

Well cause ArrayLists are more "Complex" than regular arrays so they have many different codes that remove and add variables to the Array.

Of wait getting ahead of myself now :)
List.add(x) meant that in the ArrayList of List , x was added/implemented to the end of the list. Although Mr.Jacoby didnt further explain this, to the end of the ArrayList did not mean it would literally go to the "end" but to the next space after a variable, if there was no variable inputted and x was the first, then it would be in the first.

Seems vague but most things are.

We were also refreshed on how to add a variable to an index in the ArrayList the code would be the same, a code demonstration would work out better...

List.add(1,5) <=This implements the second indeces, as we have to start counting by one, with the variable 5.

One thing what we have to keep in mind is that when an index is already being used and you add another variable to that indeces using this code, the remainder is shifted up the ArrayList.
so...
List{5,7,4,1}

List.add(1,3) <=the ArrayList will automatically shift the 7,4,1 up and the new array will be List{5,3,7,4,1}.

I NEED to finish off as I'm scared my blog will, or is taking up the webspace xD.
Extra notes>>>>>>>[ ] brackets means what you're declaring is an array,and ArrayList get larger by copying their current variables into a larger arraylist so the ArrayList space is endless and I'm guessing this wasn't so brief after all...-SANTIAGO