cs120: lecture 1 mp johnson hunter college [email protected]
Post on 21-Dec-2015
214 views
TRANSCRIPT
![Page 2: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/2.jpg)
agenda
• Admin
• Syllabus
• Survey
• Data, storage, representation
![Page 3: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/3.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/4.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/5.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/6.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/7.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/8.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/9.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/10.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/11.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/12.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/13.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/14.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/15.jpg)
gates
![Page 16: CS120: Lecture 1 MP Johnson Hunter College mpjohnson@gmail.com](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/16.jpg)
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](https://reader030.vdocuments.us/reader030/viewer/2022032521/56649d575503460f94a358be/html5/thumbnails/17.jpg)
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)