# Learning to Code: Week 10 – Understand the Whole Problem

**7/14/16**

- Excellent food for thought when it comes to solving a problem (from Shawn).

What I gave you was basically a functional requirement. Get from Atlanta to Miami.

But to get to the right answer, you have to get to the non-functional things that are important.

Is it about speed?

Is it about safety?

Do I want to see awesome scenery?

That’s one of the things that differentiates a programmer from an architect. Architects work to understand the whole problem space before running off an doing something. Or at least good ones do.

**7/15/16**

- Nothing done today. 😑

**7/16/16**

- Reddit: “Recently Graduated from a Bootcamp, here is what I learned.”
- Reddit: “Able to code with no CS degree, getting caught in interviews by fundamental CS questions. What to study?”
- My Pset 4 Recovered Pictures Gallery

**7/17/16**

- Worked on Project Euler Problem 3: LARGEST PRIME FACTOR
- http://cboard.cprogramming.com/c-programming/63450-how-return-last-element-array.html
- http://stackoverflow.com/questions/23287/largest-prime-factor-of-a-number
- Solution runs in Big O(sqrt(n))
- This was a slightly faster solution than my first method of just dividing by 2 then adding one and going on up until I hit the largest number not divisible.
- There is no need for an array of factors (the problem doesn’t call for that), just need to keep updating the factor variable with the largest one found, then print that at the end!
- http://stackoverflow.com/questions/5811151/why-do-we-check-upto-the-square-root-of-a-prime-number-to-determine-if-it-is-pri

- I emailed Sara to see what she thought of the Python intensive online course Rmotr.
- Shawn is right that free > paid, but I think the money is worth the instant feedback and group learning and also the rigid schedule that would give me no excuses to not make it work and push harder.
- My solution to Project Euler #3 HERE

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#include <cs50.h> #include <stdio.h> #include <stdlib.h> #include <math.h> /* Largest Prime Factor The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? */ int largest_factor = 0; void largestprime(long long n); int main(void) { long long number = 600851475143; largestprime(number); printf("The largest prime factor of %lli is %i\n", number, largest_factor); } void largestprime(long long n) { int d = 2; //start checking primes at 2 while (n > 1) { while (n % d == 0) { largest_factor = d; n /= d; } d++; if (d * d > n) { if (n > 1) { largest_factor = n; break; } } } } |

**7/18/16**

- Nothing done today. Too busy packing for San Diego.
- Downloaded Week 5 & 6 videos for plane ride.

**7/19/16**

- I powered through a lot of videos on the plane ride. Maybe 2.5 – 3 hours worth.
- Rewatched Lecture 1
- Lecture 2
- Scanf-0, Scanf-1, Scanf-2
- GetInt
- File pointers
- Singly-Linked Lists

- I took notes and here they are as a PDF: https://www.dropbox.com/s/dy3ump3fwedniyc/CS50%20Week%205.pdf?dl=0
- I haven’t been able to get the Daily Programmer BASIC challenge done, but the file pointers video really helped so I may be able to actually get it done now.

**7/20/16**

- MORE VIDEOS
- Doubly-Linked Lists
- CS50 Library

Notes as a PDF here: https://www.dropbox.com/s/zekoyhtho66czx7/CS50%20Week%205%20%232.pdf?dl=0