Gideon's Comp Sci Assignments

Programming assignments submitted for CS courses at WHS

Homepage

A collection of solutions written by Gideon Tong for various programming assignments at Westlake High School. This repository spans two years of classes, AP Computer Science A and Computer Science Independent Project Honors.

Usage

This repository exists only as a method of educational value. You are not to blatantly rip off someone else’s work to pass it off as your own, but learning from someone else’s code is also a valuable tool, as evidenced by the widespread use of Stack Overflow.

Why Computer Science?

Jobs that require you to have a basis in programming are now growing 12% faster than the rest of the job market. The median pay in 2017 for software developers was six figures. However, if you have an astute eye, you may have noticed the disparity between them and computer programmers, who do not make as much money. The reason why is because computer science is now about problem solving, and not about actually writing pure code. That’s being exported to other countries as the information age progresses, similar to how other revolutions like the industrial revolution progressed.

What’s the difference between software development and programming? Let’s take a look…

Let’s say you have a robot that starts at the origin of a plane. Given a sequence of movements, does the robot return to the origin? (Source: Leetcode)

Your inputs are given as four directions, U for up, D for down, L for left, and R for right.

A software developer looks at this problem and says, “Simple. We want the amount you move in the x-axis and y-axis to be the same in each respective direction.” So he writes his solution and it looks something like this:

x-direction-movement = 0 and y-direction-movement = 0
if next letter is 'U' add 1 to x-direction, subtract if 'D'
if it was 'L' or 'R', add or subtract y-direction
total, and it must be 0 to return to the origin

We call this pseudocode. This is not code, but actually just instructions on how the code should work.

A programmer looks at the problem, the solution the software developer gives him, and writes something like this:

class Solution {
    public boolean judgeCircle(String moves) {
        int x-direction-movement = 0, y-direction-movement = 0;
        for(char movement: moves.toCharArray()) {
            if(move == 'U') y--;
            else if (move == 'D') y++;
            else if (move == 'L') x--;
            else if (move == 'R') x++;
        }
        return x == 0 && y == 0;
        // The above line checks whether or not the total movements add to 0, and returns true if it does.
    }
}

The programmer is someone that can be exported to other countries where people are willing to work for lower wages. However, the software developer is paid for using his brain to come up with real world solutions.

See the importance in computer science? We’re living in the information revolution.

Contact

If you have any questions about code, feel free to contact me by any means linked within my GitHub profile page. Although code is often messy and unformatted, I’m always willing to help with understanding how or why the code works or doesn’t work.