Lecture 0 Flashcards
What is Computer Science?
Problem solving. Taking an input, putting it through a system, and retrieving and desired output.
Define unary counting.
With our fingers, where 1 finger represents 1 item.
What is binary? What is a bit?
Binary is a two digit counting system used by computers. Each binary digit is a bit.
If we have 3 light bulbs to represent binary digit, where light on is 1 and light off is 0, how high can we count?
If we consider that there are only 8 possible combinations of on and off given 3 bulbs, and we assume that all three in off represents 0, then the highest we can count is 7.
Lines up like:
2^2 // 2^1 // 2^0
# // # // #
With each slot (#) coinciding with incremental powers of 2
Determine the number of possible combinations given a binary system and 3 decimal places.
The binary system requires we use 0 and 1 as the only digits. With three places to put two possibilities, the mathematical representation of this relationship is 2^3 possibilities, which is 8. Adding a new decimal place raises the power.
What about if we extended to 8 bulbs? How High could we count?
With eight bulbs, we calculate 2^8 as 256 possibilities. One of which is already defined as 0, leaving the highest possible digit as 255 if we only include positive integers.
Only using bits, how can we represent letters in a computer?
Agree on a number (65) that coincides with a letter (A) and represent that number in binary (10000001).
What is ASCII?
It’s an 8 bit system used to represent 255 characters on computer screens. Primarily used for English.
What is Unicode?
Extends beyond ASCII by using more bits to represent additional characters (chinese / letters with accents / emojis).
How are colors represented on a computer?
Each color is represented by three bytes (8 bits allowing for a range of 255) that correspond to amounts of RGB. So, (72,73,33) is a dark shade of yellow.
How is an image represented on a computer.
Each three byte color is given a square of space to occupy on the screen -> a pixel. So, when you have a 31mb picture saved to your computer, the resolution of that image corresponds to the number of pixels in the image (# of pixels * 3 bytes per pixel = file size).
What is an algorithm?
They are step-by-step instructions for solving problems.
what is the best solution (or algorithm) for finding your name in a phone book?
LOGARITHMIC ALGORITHM. Computation gives us logarithms (inverse function of exponents). In practice it can be summarized to: divide the number of pages by half and go there (if 1000 pages, go to page 500). Decide if the name is before or after page 500 and divide the remaining step by 2, decide if left or right of page 250 (or 750 if took right half). Even if out pages double, we only add 1 step (2000/2 = 1000, continue with above example).