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.


No comments:

Post a Comment