17
CS120: Lecture 1 MP Johnson Hunter College [email protected]

CS120: Lecture 1 MP Johnson Hunter College [email protected]

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

CS120: Lecture 1

MP Johnson

Hunter College

[email protected]

Page 2: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

agenda

• Admin

• Syllabus

• Survey

• Data, storage, representation

Page 3: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

admin

• Sessions: 9:48-11:26am / 11:36-1:14pm HW 224• Class page• Email• Text• OHs tba• Grading

– Hw (written, prog., labs) – O(6) ~ 45%– Exams – 20% + 25%– Class partic/quizzes – 10%

• Start or end of class

• Attendance is required – 80%

Page 4: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Core Class topics

1 Breadth-first tour of CS2 Data

– storage– Representation of knowledge)– Compression (JPG, MP3)

3 How computers work– Machines

4 networks, Internet, OS1 HTML2 FTP, SSH

5 Algorithms – good ones?6 Programming / SE / data structures

Page 5: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Advanced/optional

• AI• Hardware• Crypto• Unsolvable problems• Search Engines• Social/political issues?

• Other topics?• Some parts of class will be challenging• Many will be applied/topical – read Slashdot/Digg

Page 6: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Survey

1. Name

2. Email (clearly!!)

3. Grade-level

4. Major

5. Why taking class

6. Topics you’re most interested in

Page 7: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Q: What are comps?

• A: machines that compute

• Q: compute what?

• A: the output of some algorithm

• Alg: list of instructions / recipe– Abstract but unambiguous (how?)– Much more later

• Egs: long division algorithm, gcd, sorting

Page 8: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Long (pre)history

• Abacus (3000BC) – just storage• Pascal (1600s) – addition• Leibniz (1600s/1700s) – math• Babbage Diff. gin (1800s) – math• Babbage An. Gin – punched

cards

• All these were mechanical (gears, etc.)– Difficult to make reliable & fast &

cheap

Page 9: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

20th C: electronics

• Circuits, transistors, etc.• Mach 1, ENIAC, UNIVAC (1940s) - room-sized

• Since then: “just” miniaturization• Mainframes supercomps, minis PCs

(“micros”): early 80s on• All “essentially” same:

– Run many programs (v. arcade machine)– These programs impl. Algs (tho in diff. langs)– They store, rep, use data

Page 10: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Today: data

• CS = abstraction + reduction– “that’s so reductive”

• In CS, all data is numbers,

• All numbers are bits (0/1) / bools (F/T)

• Bit = binary digit

• boolean ~ George Boole (1800s)

Page 11: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Bool logic/algebra

• Vals: F, T

• Ops: and, or, xor, not

• Draw truth tables

• Xor intuit: soup or sald

• Can write exprs

• Exprs can nest

Page 12: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Bool expr eg

• Suppose A ~ empl A is working, B, C

• Suppose want: should always be exactly one empl working

• Q: If we only know bool logic, how to test?

• Q: how to write a “program” for this in bool logic?

• (A & ~B & ~C) | …

• (A xor B) & …

• (A | B | C) …

Page 13: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Q: How to compute/eval this?

• We now understand bool ops, so we could perform each op ourselves– A gp of female workers in WWII were called

“computers”

• Bad: too slow, error-prone

• Funda strength of comps: can do some (v. simple) things v. fast

Page 14: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

strategy

• Don’t: create a special machine to comp whole expr/function/program

• Do: create a little machine for each component, then combine– Forget about software for now!

• How? First, bool ops gates

Page 15: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

gates

Page 16: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Gates elec circuit

• No one of these is v. interesting• But two big insights:

– Can create an implement gate electronically• 0/1 low/high current

– Gates can be combined to produce powerful computations / representations

electronic circuits / chips

• Draw circuits for each expr

• Of course, want software (non-kickable)• For that we need a compiler…

Page 17: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com

Circuits as memory

• Flipflop: special circuit that can store data– 1 bit per FF

To store, send pulse in top or bottom (0 is ddf)

Go through

Reading for next week: wiki entries on boolean logic and two’s complete(through section 2 only)