CS50x Lecture 0
Lecture 0 of Harvard's CS50x
Introduction
I'm just watching the videos from this course to get a more formal understanding of some fundamental concepts in CS, such as efficiency and Big O notation. I won't be doing the problem sets, though they're free to access of Harvard edX website!
Notes
- Computers deal with information in binary format.
- Each switch within a computer is either on (1) or off (0) and is called a bit.
- The physical switches within these computers are called transistors.
- The switches combine in a base-2 format to form larger numbers.
Base-2 Representation of Numbers
- In base-10, numbers are represented as powers of 10, e.g., the number 12 = 1*(10^1) + 2*(10^0).
- Similarly in base-2, numbers are represented as powers of 2, e.g., 11 = 1*(2^1) + 1*(2^0) = 3 (in base-10).
- The largest number you can represent with N binary digits (or bits) is 2^N - 1, since we include 0.
- In general, if you have N bits, you can permute them in 2^N ways.
- Bits can also be used to represent letters (and in fact they must be, if we ever want to send information in the form of letters and words)
- In ASCII (American Standard Code for Information Interchange), the letter A is represented by the decimal digits 65, or the binary digits 01000001.
- ASCII uses 8 bits to represents numbers, letter, and symbols - plenty of permutations (256) for English, but not enough for a language like Chinese.
- Unicode uses 32 bits to represent characters and symbols, and this regime has largely replaced ASCII, since unicode can represent billions of symbols.
- Base-2 representations can get long at this point, e.g., 10011001010000010111001100111111.
- Even the decimal representations can be too long. So a new representation, hexidecimal, can be used. It'll look something like this: U+1F602.
- Colors, music, numbers, letter, photos and videos can all be represented in computers.
- In fact, anything can be represented digitally, with bits.
Algorithms
- An algorithm is a way, a formula of steps, on how to solve a problem.
- At the very least, our goal should be an algorithm which solves our problem correctly.
- But we also aim for efficiency.
Conclusion
Not too much new info in the first lecture, but the lecturer is interesting and engaging!
Edit* I've decided not to proceed with future lectures, as they seem a bit too basic for my level of coding experience. But I may refer to to the SQL lecture later, since I have very little experience with that!
Comments
Post a Comment