I also have to mention, I was going to write a slog about problem solving question so i sent Danny an email requesting some problem solving questions. However i noticed that i sent the email to the erroneous address of heap@cs.utoronto.edu instead of heap@cs.toronto.edu. Sorry for the mistake.
Sunday, 31 March 2013
11th week of the course
on the 11th week of the course, the professor firstly explained what is to be done for the final assignment tat is due on friday. Then, he moved on to contents in the lecture notes and talked about how internet works. He sent a ping to a certain website in austrailia and showed how long it takes send a response back to his computer. Also on thursday, he showed the daily time spent by human beings at which their work is most productive. He showed that after certain time has passed hour work results in negative outcome due to error, and sleeplessness is one of the biggest factor why that causes this depressing result. Our cognitive skills is ultimately limited when we do not sleep.
Monday, 25 March 2013
recursion hand-out (week of 11)
Last week, I had trouble understanding the last function from the recursion hand-out. The function, i had hard time to figure out is defined as:
(require picturing-programs)
(define (s d)
(cond
[(> d 0)
(beside/align 'bottom
(line 0 (+ 5 (* 2 d)) 'red)
(rotate 90 (s (- d 1))))]
[else (line 0 5 "red")]))
I was playing around with it and started plugging numbers into the functions described above. (s 0) produced just vertical red line that is 5 pixels long. (s 1) produced two lines one laying horizontally in the bottom and the other attached vertically left to this line. Until now, i was just yawing at what functions produced. However, when i plugged (s 30) i was stunned by the result.
Initially, i had to understand where the (line 0 5 "red") comes from. I noticed that this function is derived from the Pythagorean theory; (c^2 = a^2 + b^2) where the two numbers from the function represent the vertical and horizontal component (a and b) of the line.
Now, i now know what this function is comprised of, i had to understand what the function as a whole do.
(s 0) produced one vertical line because of the condition if d is not bigger than zero or represent anything other, it just produces (line 0 5 "red").
(s 1) produced two lines as i described above. This was not surprising because from the portion (line 0 (+ 5 (* 2 d)) 'red), if we plug 1 instead of two, it results in (line 0 7 "red"). Therefore, it aligns a vertical line that is 7 pixels long with a (rotate 90 (s 0)), which is the vertical line that is 5 pixels long but rotated by 90 degrees.
(s 2) produced three lines. I was just taken aback for a moment from wondering where did the extra line came from. Then, i noticed that from the portion (rotate 90 (s (- d 1))), when i plugged the 2 into only this part, it already produced two lines!! Therefore, attaching that to the (line 0 (+ 5 (* 2 (2))) 'red) produced three lines, two vertical and one horizontal.
Therefore i noticed that the function (s d) (where d is a number) rotates the figure produced by (s d-1) by 90 degrees and attach the vertical line to it.
(require picturing-programs)
(define (s d)
(cond
[(> d 0)
(beside/align 'bottom
(line 0 (+ 5 (* 2 d)) 'red)
(rotate 90 (s (- d 1))))]
[else (line 0 5 "red")]))
I was playing around with it and started plugging numbers into the functions described above. (s 0) produced just vertical red line that is 5 pixels long. (s 1) produced two lines one laying horizontally in the bottom and the other attached vertically left to this line. Until now, i was just yawing at what functions produced. However, when i plugged (s 30) i was stunned by the result.
Initially, i had to understand where the (line 0 5 "red") comes from. I noticed that this function is derived from the Pythagorean theory; (c^2 = a^2 + b^2) where the two numbers from the function represent the vertical and horizontal component (a and b) of the line.
Now, i now know what this function is comprised of, i had to understand what the function as a whole do.
(s 0) produced one vertical line because of the condition if d is not bigger than zero or represent anything other, it just produces (line 0 5 "red").
(s 1) produced two lines as i described above. This was not surprising because from the portion (line 0 (+ 5 (* 2 d)) 'red), if we plug 1 instead of two, it results in (line 0 7 "red"). Therefore, it aligns a vertical line that is 7 pixels long with a (rotate 90 (s 0)), which is the vertical line that is 5 pixels long but rotated by 90 degrees.
(s 2) produced three lines. I was just taken aback for a moment from wondering where did the extra line came from. Then, i noticed that from the portion (rotate 90 (s (- d 1))), when i plugged the 2 into only this part, it already produced two lines!! Therefore, attaching that to the (line 0 (+ 5 (* 2 (2))) 'red) produced three lines, two vertical and one horizontal.
Therefore i noticed that the function (s d) (where d is a number) rotates the figure produced by (s d-1) by 90 degrees and attach the vertical line to it.
Wednesday, 20 March 2013
Finally over!!
It has been tough time for me for several weeks. term-tests every consecutive weeks. I have just wrote my last mid-term today! finally over! last week i have written my second term-test for this course. I hope i did well. I actually forgot to write a slog for the last week and I had to skip for the lecture on tuesday this week, because i was busy studying for the test. Well, i have just saw my marks on markus, and noticed the poor mark received for wikipedia part 2. I expected a low mark as well, and i actually could not know how to start this project at all from the first place... oh well, i will just try my best for wikipedia part 3 and hope to gain good mark. I need to work harder on this because articles that i have chosen are ridiculous that i have no idea how to change them. Since all mid-terms are over, i will be coming to every lecture and not fall behind for the remaining of the semester, and get prepared for my final exam also, writing slogs every week.
Monday, 4 March 2013
busy...
Last week was really busy week for me, but still managed to get through. Upcoming several weeks will be busy as well. Therefore, i think i need to manage my time well to do good in csc104! That is all i can say for this week's slog :(
Subscribe to:
Posts (Atom)