cs 16 – aug. 28 definition of computer & cs making good decisions computer organization a...
TRANSCRIPT
![Page 1: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/1.jpg)
CS 16 – Aug. 28
• Definition of computer & CS
• Making good decisions
• Computer organization
• A little history
![Page 2: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/2.jpg)
Computer definition
• An electronic device that can retrieve, store and process data
• You can do these things too!
• What is the difference?
![Page 3: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/3.jpg)
Computer science
• Systematic study of how we …– solve problems – represent & manipulate information
• Computer has large memory and fast “brain” – ideal for testing theories
![Page 4: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/4.jpg)
Good decisions
• Correct (not misleading)
• Relevant
• Significant (don’t play weak cards)
• Complete/thorough– Consider alternatives, suggest future work
• Reasonable– Balance between acceptable & ideal
![Page 5: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/5.jpg)
Computer organization
• Definition gives hint on how a computer is organized…
• Retrieve/store data: computer’s memory
• Process data: the CPU
• Communication is also essential– I/O devices– network
![Page 6: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/6.jpg)
Hardware vs. Software
• CPU
• Memory
• Peripherals
• network
• Helps us interact with the machine
• Gives it soul or behavior
• Translates to/from machine language
![Page 7: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/7.jpg)
Before 1940s
• Only analog machines, moving parts
• Specific purpose– Adding machines– Tabulators– Sunrise/sunset, celestial
• General computing only theoretical interest– Alan Turing
![Page 8: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/8.jpg)
1940s
• Code-breaking machines in WW 2
• General purpose electronic computers– ENIAC, U. of Pennsylvania– ABC, Iowa State– Z3, Konrad Zuse in Germany
• Transistor (1947) to have impact later
• von Neumann concept forms basis of computer organization
![Page 9: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/9.jpg)
1950s & 1960s
• Commercially produced computers (IBM)– gradually become more common in industry
• Programming languages developed to facilitate commands to the machine
• Colleges begin to teach computing
• Large and expensive
• Moore’s Law
![Page 10: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/10.jpg)
1970s & 1980s
• Integrated circuit (1971) allows computers to become much smaller– Intel chips 4004, 8008, 8086, 80286, etc.
• Personal (home) computing– Applications for non-specialists
• Intense competition • Internet only used in large companies,
universities
![Page 11: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/11.jpg)
1990s & 2000s
• Computer for communication and mass medium
• Internet as a virtual library & soapbox
• Tech companies (Apple, Microsoft, Intel, Nokia,…) mature and gain clout
• Growing need to manage information
![Page 12: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/12.jpg)
Course topics
• Representing information in binary form.• What a computer system is made of.• A problem solving machine!
– Spreadsheets, databases, image processing, …
– Giving commands to the computer
• Please read chapter 1• Next day: chapter 2: binary numbers
![Page 13: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/13.jpg)
CS 16 – Sept. 2
• Binary numbers– Interpreting binary decimal– Converting decimal binary– patterns & observations– shorthand
• Work on Binary worksheet• Bring Excel book to lab next Monday
– Read pp. 71-114, just the white pages
![Page 14: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/14.jpg)
Binary Numbers
• Binary = “base 2”
• The “2” means each bit is either 0 or 1
• To interpret a binary number,
use place value system.
![Page 15: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/15.jpg)
Place value system
• In base 10, what does 278 mean?
• 278 = 2 * 102
+ 7 * 101
+ 8 * 100
• Each digit corresponds to a power of 10
![Page 16: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/16.jpg)
Binary example• So now let’s try base 2: What is 11010?
1 * 24 + 1 * 23 +
0 * 22 +
1 * 21 +
0 * 20
• More concise to simply say24 + 23 + 21
![Page 17: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/17.jpg)
Powers of 2
• 20 = 1
• 21 = 2
• 22 = 4
• 23 = 8
• 24 = 16
• 25 = 32
• 210 ~ 1 thousand
• 220 ~ 1 million
• 230 ~ 1 billion
• 240 ~ 1 trillion
![Page 18: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/18.jpg)
Binary Decimal
• In a binary number, each “1” gives you a power of 2
• More examples:
11
101
110
1110
![Page 19: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/19.jpg)
Questions
• Let’s say we have 4 bits.
• What is the lowest number?
• What is the highest number?
• Try same experiment with 5 bits.
![Page 20: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/20.jpg)
Number of Possible Values
• 1 bit: 0 and 1
• 2 bits: 00, 01, 10, 11
• 3 bits: 000, 001, …?
• For a given number of bits, how many patterns?
![Page 21: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/21.jpg)
decimal binary
• You already know binary decimal
• But given a decimal number like 45, what is binary form?
• Binary numbers are longer than decimal.– (Ex. 5 digit number may require 15 bits)
• My technique is the “binary store”
![Page 22: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/22.jpg)
Binary store
• At the Binary Store, price is a power of 2: $1, $2, $4, $8, $16…
• If you had $45, what could you buy?
• 45 = 32 + 8 + 4 + 1
• Write powers of 2: 25 + 23 + 22 + 20
• Write binary number: 101101
![Page 23: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/23.jpg)
Another example
• Let’s convert 61 to binary:
• Go to binary store with $61…
61 = 32 + 16 + 8 + 4 + 1
61 = 25 + 24 + 23 + 22 + 20
Finally: 111101
![Page 24: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/24.jpg)
Octal
• Octal means base 8: each digit is a power of 8.
• Because 8 = 23, each octal digit corresponds to 3 bits
• 4618 = 100 110 0012
• 73258 = ?
![Page 25: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/25.jpg)
Hexadecimal (“hex”)
• Base 16: each digit is a power of 16
• Since 16 = 24, each hex digit corresponds to 4 bits.
• Hex also means we have 16 different digits.
• a = 10, b = 11, c = 12, d = 13, e = 14, f = 15
![Page 26: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/26.jpg)
Hex examples
• 96416 = 1001 0110 01002
• d12316 = 1101 0001 0010 00112
• Now let’s go the other way:
• 1110002 = ______16
• 100111112 = _______16
![Page 27: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/27.jpg)
Decimal octal, hex
• Often the best way to come up with octal or hex is to go thru binary first.
• Ex. What is 71 in octal?– Binary store gives: 71 = 64 + 4 + 2 + 1– Binary number is 1000111
– Grouped as octal: 001 000 1112 = 1078
• We can check answer.
![Page 28: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/28.jpg)
Why couldn’t the computer scientist tell the difference between Halloween (Oct 31) and Christmas (Dec 25) ?
![Page 29: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/29.jpg)
CS 16 – Sept. 8
Excel– values and formulas– Awesome number cruncher– Slick functions: sort, subtotals, charts– Can help answer probing questions
• White pages = reading• Yellow pages = lab
• Only one thing I don’t like about Excel…
![Page 30: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/30.jpg)
Bill Gates – Microsoft
![Page 31: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/31.jpg)
Spreadsheets
• Looks like graph paper
• Cells, rows, columns, pages (worksheets)
• Each cell has a name, like E3.
• Into each cell you may type either:– value – formula
![Page 32: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/32.jpg)
How we use Excel
• Enter data
• Ask Excel to calculate formulas
• Insert more data: Excel recalculates.
• Look for trends, conclusions
• Can format to make look professional.
![Page 33: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/33.jpg)
Excel 2007
• New version: different appearance from before• File names now end in .xlsx instead of .xls
– If you find an older version spreadsheet, can “save as” new version.
• New features– Can support larger spreadsheets
– Smaller file size – (More options for presenting data, formatting) …
![Page 34: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/34.jpg)
Chapter 1
• Entering text & formulas
• Navigating a spreadsheet– Workbook, worksheet, rows, columns
• Adjusting row & column width
• Adding/deleting rows & columns
![Page 35: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/35.jpg)
Examples
• Keeping track of calories for a week– Total calories per day– Average calories per meal
• The cost of going to college– How fast is cost rising?– What share is tuition?
• Grade sheet: formulas
![Page 36: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/36.jpg)
Spreadsheet data
What can you put in a cell?• Value: text label or a numerical value• Formula
– Ex. =b1 + b2 + b3 + b4– Ex. =sum(b1:b4)
– Excel functions are very convenient! We’ll use about 10-20 of them.
![Page 37: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/37.jpg)
Hints for formulas
• Use cell ranges, like B3:C7
• Absolute reference– Won’t change when formula copied/moved– Signify with $, as in $E$9– Ex. Calculate a percent share.– Helps avoid “magic numbers”.
![Page 38: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/38.jpg)
Functions
What kinds of functions can Excel do?
• Arithmetic (average, count, sum, …)• Logical (if, countif, sumif, and, or, …)• Statistical – variance, normal curve, …• Financial – interest, loans, annuities, …
• And more!
![Page 39: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/39.jpg)
Ready for lab?
• Best to read white pages before lab – explains the details.
• Peek at end of “hands-on exercise” to see what spreadsheet will eventually look like.
• Copy entire Exploring Excel folder to your memory stick
![Page 40: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/40.jpg)
CS 16 – Sept. 9
Chapter 3: data representation• Many kinds of data all in binary• Today: integers
– Unsigned– Signed– BCD
• Later: text, images, code, etc.
![Page 41: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/41.jpg)
Different kinds of data!
Kind of data File type Software used
Numbers.xlsx
.accdb
Excel
Access
Text
.txt
.doc
.html
NotePad
MS Word
Dreamweaver
Image .gif Photoshop
Instructions .exe The operating system
![Page 42: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/42.jpg)
Converting to binary
• A computer system has both HW & SW• HW: only understands binary• SW: Translates human information into binary for
the HW.• How?
– Break into pieces (digits, words, letters, symbols, pixels, …)
– Each piece individually gets a binary number.
![Page 43: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/43.jpg)
Data vs. information
• What does 29613 mean to you? Or is it just a random number?
• What might 111010110101110010… mean to the computer?
• Information means that we are adding “meaning” to the data
• Binary is like the alphabet… all languages use it to give meaning to letters. What is “pet set” ?
![Page 44: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/44.jpg)
Analog vs. Digital
• Analog is how WE understand the world
• Just “warmer” or “crooked” is enough for us
• Can handle “in between” values
• Think of a clock, speedometer, odometer
• Digital emphasizes exact values, usually expressed as 0 or 1, true or false.
• No such thing as “in between.” It’s either 10:30 or 10:31…
![Page 45: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/45.jpg)
An analogy
Think of the notes on a piano.• 88 keys• Range: from lowest to highest key.• Granularity: distance between consecutive notes.• But for computer, notes are converted to binary
numbers!
![Page 46: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/46.jpg)
Representations
• To represent anything in binary, need to know:– Number of bits? (size)
– What do the bits mean? (scheme)
• Representation schemes for integers:– unsigned– signed– BCD
![Page 47: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/47.jpg)
Size of rep’n
• Most often 8, 16, or 32 bits
• For our examples, we’ll use small sizes
• 5 bits: 25 different numbers
• 32 bits: 232 different numbers
![Page 48: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/48.jpg)
Scheme I: Unsigned
• Ordinary binary number. • For 5 bits: smallest = 00000 (zero)
largest = 11111 (31)
• In general, smallest = 0, largest = 2n – 1.
• Going beyond possible range: “overflow”
![Page 49: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/49.jpg)
Scheme II: Signed
• Allows for negative numbers
• We want half the rep’ns to be negative.
• Ex. 5 bits 32 numbers.– 16 numbers are negative– Thus, range is –16 to +15.
• For n bits: range is –2n–1 to 2n – 1 – 1
![Page 50: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/50.jpg)
How to represent negatives
• In unsigned, impossible!
• In signed: 3 steps to represent –x:– Find rep’n of +x.– Invert the bits.– Add 1.
• Try some examples.
![Page 51: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/51.jpg)
How to represent negatives
• In unsigned, impossible!
• In signed: 3 steps to represent –x:– Find rep’n of +x.– Invert the bits.– Add 1.
• Try some examples.
![Page 52: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/52.jpg)
Closer look at signed
• In 5 bits: largest number is 01111 (+15)
lowest number is 10000 (–16)
• Leftmost bit is “sign bit”
• Positive #’s have same rep’n as unsigned.
• Technique for –x doesn’t work for –16.
![Page 53: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/53.jpg)
Recap example
• What does 110010 represent if interpreted as:– 6 bit unsigned?– 6 bit signed?
![Page 54: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/54.jpg)
Scheme III: BCD
• “Binary Coded Decimal”– Each decimal digit corresponds to 4 bits.– Easy conversion for binary decimal
• Ex. 278 = 0010 0111 1000
• If we have 8 bit BCD, what is the range?
• Waste
![Page 55: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/55.jpg)
Having enough bits
• Question – Are 6 bits sufficient to represent the number 50?
• Answer – Depends on the rep’n scheme. Let’s look at each one.
![Page 56: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/56.jpg)
CS 16 – Sept. 11
• Integer rep’n– Unsigned & signed √– Sign-magnitude– BCD
• Real numbers– Contrast with integers– Convert to binary– Representation & Distribution
![Page 57: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/57.jpg)
Recap example
• What does 110010 represent if interpreted as:– 6 bit unsigned?– 6 bit signed?
![Page 58: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/58.jpg)
Scheme III: Sign-magnitude
• Leftmost bit works like a +/- sign.• Remaining bits behave like unsigned.
• Example: what is 11001 ?– Leftmost bit “1” means number is negative– Remaining bits are 1001 = 9, so entire number is –9
• What would –20 look like in 8 bits?– +20 looks like 10100 or 00010100– To make it negative, change first bit to 1.
![Page 59: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/59.jpg)
Scheme IV: BCD
• “Binary Coded Decimal”– Only good for positives.
– Each decimal digit corresponds to 4 bits.
– Easy conversion for binary decimal
• Ex. 278 = 0010 0111 1000
• If we have 8 bit BCD, what is the range?• Waste
![Page 60: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/60.jpg)
Having enough bits
• Question – Are 6 bits sufficient to represent the number 50?
• Answer – Depends on the rep’n scheme. Let’s look at each one.
![Page 61: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/61.jpg)
Integer vs. Real
• Integer arithmetic on computer is quick and exact, but limited range
• Real arithmetic needs wide range, reasonable degree of precision– Preferred for numerical computation– 14 significant digits is usually enough!
![Page 62: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/62.jpg)
Binary examples
Look at this sequence:
111 = 7
1110 = 14
11100 = 28
111000 = 56
1110000 = 112
• Let’s go the other way
111. = 7
11.1 = 3.5 or 7/2
1.11 = 1.75 or 7/4
.111 = 7/8
.0111 = 7/16
![Page 63: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/63.jpg)
Another example
10100 = 20
1010 = 10
101 = 5
10.1 = 2.5 or 5/2
1.01 = 1.25 or 5/4
.101 = 5/8
Each digit corresponds to (+/–) power of 2.
![Page 64: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/64.jpg)
Convert to binary
• Separate number (e.g. 5.7) into integer and fractional parts.
• Integer part? Binary store.
• Fractional part:– Keep multiplying fractional part by 2 until it
becomes zero, or until you have a repeating pattern.
![Page 65: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/65.jpg)
Example
Convert 9.625 to binary.• “9” becomes 1001.• Fractional part is 0.625:
.625 * 2 = 1.25
.25 * 2 = 0.5
.5 * 2 = 1.0
Fractional part reached 0. So answer is 1001.101
![Page 66: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/66.jpg)
Example
Let’s convert 4.6875 to binary
The “4” becomes 100.
Fractional part is 0.6875:
.6875 * 2 = 1.375
.375 * 2 = 0.75
.75 * 2 = 1.5
.5 * 2 = 1.0
Fractional part reached 0. So answer is 100.1011
![Page 67: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/67.jpg)
Repeating pattern
• Let’s try converting 0.7 to binary.
.7 * 2 = 1.4
.4 * 2 = 0.8
.8 * 2 = 1.6
.6 * 2 = 1.2
.2 * 2 = 0.4
And we’ve seen “.4” already. ____
Answer is .1 0110 0110 0110 … or .10110
![Page 68: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/68.jpg)
Real-number rep’n
• Also called “Floating-point”• Size is 32 or 64 bits.• Based on “binary scientific notation”• Only one scheme is used:
1 bit for sign 8 bits for exponent 23 bits for mantissa
• Big mantissa precision
![Page 69: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/69.jpg)
Distribution
• 8 bit exponent 256 different exponents– Biggest number ~ 1038.– Smallest (+) number ~ 10–38.
• 23 bit mantissa 8 million numbers per power of 2.
• Three kinds of numbers can’t be represented. (Where are they?)
![Page 70: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/70.jpg)
CS 16 – Sept. 15
Excel
• Review: values, formulas, functions
• Absolute and mixed references
• Creating Charts
![Page 71: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/71.jpg)
Functions in Excel
• =sum(a1:a4) better than =a1+a2+a3+a4
• Function menu– Can fill in the blanks step by step
• Example – loan payment– Use “pmt” function– Takes 3 parameters, but too much to remember
![Page 72: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/72.jpg)
![Page 73: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/73.jpg)
Absolute references
• Purpose– For constants in a formula– When you don’t want a cell reference to change
when the formula gets copied
• Use “$” as in $E$3 (instead of just E3)
• Examples– Percent of total, sales tax.– Multiplication table (mixed ref.)
![Page 74: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/74.jpg)
Mixed references
• Sometimes used when you want to copy a row or column full of formulas
• $B7 – When we copy, only row # changes.
• B$7 – When we copy, only col # changes.
• Let’s look again at calorie example.
![Page 75: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/75.jpg)
Some stat functions
• Count – # of cells containing numbers
• Counta – # of cells with numbers or text• Countif – number of cells satisfying a
condition you specify (useful in a game!)
• Max and Min
![Page 76: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/76.jpg)
The if function
• Takes 3 parameters:– Question or condition to test– Value if true– Value if false
• Ex. =if(E3 < 65, “Heat”, “A/C”)
• Ex. =if(D8 > 0, D7 / D8, “”)
• Let’s look at climate-data example
![Page 77: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/77.jpg)
vlookup function
• Shortcut for doing lots of if’s in a row.• Ex. Grading scale
=if (B7 >= 90, “A”, if (B7 >= 80, “B”, if (B7 >= 70, “C”, if (B7 >= 60, “D”, “F”))))
• Better approach:– Write grading scale into spreadsheet– Use vlookup to “look up” the right grade.
![Page 78: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/78.jpg)
Tic-Tac-Toe in Excel
• Goals:– Keep track of whose turn it is– Need to know if game over
• Strategy:– Use +1 for ‘X’ and –1 for ‘O’– Sum of board tells whose turn it is– Sum of row/col/diagonal can find winner.
![Page 79: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/79.jpg)
Charts
• Excel creates a chart based on numbers in spreadsheet.
• Updated automatically when you change numbers.
• To create:– Select data (and labels)– InsertChart
![Page 80: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/80.jpg)
Steps to creating chart
• What data do you want in chart?
• Make choices about the chart:– What kind of chart? (column, pie, X-Y, ...)– Format of chart (title, legend, colors, ...)– Where do you want chart?
• When done, can paste chart to another document.
![Page 81: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/81.jpg)
Chart examples
• Furman cost
• Calorie … 3-D
• Size of houses by state
• Big chart: maybe need to adjust scale
• *** Often a good idea to sort data.
![Page 82: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/82.jpg)
CS 16 – Sept. 16
• Representing information
Not just in binary, it has to be organized:– Linear
– Non-linear• Network: graph
• Hierarchy: tree
• Representing text– ASCII and Unicode
– Compression
![Page 83: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/83.jpg)
Linear organization
• Definite begin & end• One logical way to read (forwards)• Used for: text, audio, images, video
• One file consists of many “cells” of data– Individual character, musical note, pixel on screen,
frame of movie
– It’s convenient if each “cell” is a whole number of bytes. 1 byte = 8 bits.
![Page 84: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/84.jpg)
Digitizing data
• Text– Break up information into characters
– Each character represented by a binary number
– How many different binary numbers will we need?
– Need to encode formatting commands as well. E.g. some text may be in a different font.
• Music/audio– Can break up song into notes
– What information is in a “note” ?
– How frequently do notes come? Sampling
![Page 85: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/85.jpg)
Digitizing data (2)
• Images– Break up picture into pixels, each becomes a number.
– How many pixels do we need?
– The pixel values are colors. How many different colors do we want?
• Video– A sequence of images. – How many images per second?
– (Also need to include sound on the side.)
![Page 86: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/86.jpg)
Non-linear organization
• Either there’s no logical begin/end to information, or many ways to travel thru it.
Graph (network) Tree (hierarchy)
![Page 87: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/87.jpg)
Tree example
• We use trees to represent mathematical expressions. There’s a hierarchy because of the order of operations.
*
+ –
3 4 7 8
![Page 88: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/88.jpg)
Representing a tree
• Normally we’d write
(3 + 4) * (7 – 8)
• More efficient to use “postfix” or RPN notation:
3 4 + 7 8 – *
*
+ –
3 4 7 8
![Page 89: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/89.jpg)
The joy of text
• ASCII code:– Contiguous (makes it easy to alphabetize)– Case sensitive– One byte per character
• ASCII table (p. 67)– ‘A’ = 65 ‘a’ = 97 ‘0’ = 48– Try this example: “Dog”
![Page 90: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/90.jpg)
Unicode
• An extension of ASCII• Incorporated into the Java language.• Uses 16 bits instead of 8.
• Supports foreign alphabets; symbols
(examples on p. 68)
![Page 91: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/91.jpg)
Text Compression
• Goal is for a document to take up less space.• Techniques
– Keyword encoding: replace common words by special symbols like δ ↕ ╞
– Run-length encoding: replace repetitions with a number: “pppppppppppppp” [14p]
Also works well for compressing images, sound.
– Huffman code: common letters should take up fewer bits.
![Page 92: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/92.jpg)
Huffman code example
• Suppose you want to send a message and you know the only letters you need are A,D,E,L,N,P,S.
• Try this code:
A D E L N P S
001 100 01 101 0001 0000 11
![Page 93: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/93.jpg)
CS 16 – Sept. 18
• Finish Huffman code compression
• Image representation– B/W and color schemes
– File size issues
![Page 94: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/94.jpg)
How to create code
• In CS we often use “trees” to help us solve problems.
• We’re given set of letters used in message, and their frequencies.– Ex. A=5, B=10, C=20, D=25, E=30– Ex. P=5, N=10, D=10, L=15, A=20, S=20, E=30
• Arrange frequencies in order• Group the letters in pairs, always looking for the
smallest sum of frequences Create a tree!
![Page 95: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/95.jpg)
Huffman code example
• Suppose you want to send a message and you know the only letters you need are A,D,E,L,N,P,S.
• Try this code:
A D E L N P S
001 100 01 101 0001 0000 11
![Page 96: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/96.jpg)
Images
• Fundamental unit is pixel
• Size = usually 8 bits
• Scheme = grayscale, range 0-255
• Dimensions given as (horiz vert)
– Ex. 400 300 120,000 pixels
– Note that an 8-bit pixel = 1 byte
• Aspect ratio
– Ex. 4 to 3
– When changing size, ratio shouldn’t change
![Page 97: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/97.jpg)
Properties of rep’n
• “Sampling & Quantizing”
• Resolution of image– total number of pixels in image
• Dynamic range– How many shades of gray
• To reduce file size– Reduce either # of pixels, or # bits/pixel– Book shows us examples of each…
![Page 98: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/98.jpg)
Resolution
• here is a (edited) digitized image with a resolution of 272 x 416
Picture resolution determines both the amount of detail as well as its storage requirements
![Page 99: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/99.jpg)
Resolution
• notice the changes when the resolution is reduced (136 x 208)
Picture resolution determines both the amount of detail as well as its storage requirements
![Page 100: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/100.jpg)
Resolution
• notice more changes when the resolution is reduced (68 x 104)
Picture resolution determines both the amount of detail as well as its storage requirements
![Page 101: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/101.jpg)
Dynamic Range
• Here is an intensity or graylevel image with 256 levels (i.e., 0 to 255 scale)
DYNAMIC RANGE refers the number of values for the measuring scale used in quantizing
![Page 102: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/102.jpg)
Dynamic Range
• Here is an intensity or graylevel image with 16 levels (i.e., 0 to 15 scale)
DYNAMIC RANGE refers the number of values for the measuring scale used in quantizing
![Page 103: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/103.jpg)
Dynamic Range
• Here is an intensity or graylevel image with 4 levels (i.e., 0 to 3 scale)
DYNAMIC RANGE refers the number of values for the measuring scale used in quantizing
![Page 104: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/104.jpg)
Dynamic Range
• Here is an intensity or graylevel image with 2 levels (i.e., 0 to 1 scale or a binary image)
• Dithering can help
DYNAMIC RANGE refers the number of values for the measuring scale used in quantizing
![Page 105: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/105.jpg)
Don’t overdo it
• Too little resolution: pixelated
• Too few bits per pixel: sharp edges, cheap– Extreme case is “binary image”
• Note that n bits per pixel gives 2n values in dynamic range. 0 is black, 2n – 1 is white– Examples: n = 8, 4, 2, 1
![Page 106: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/106.jpg)
B/W vs. Color
• B/W: usually 1 byte (8 bits) per pixel– Each pixel = grayscale number 0-255– Ex. 180 is a brighter shade of gray
• Color: usually 3 bytes (24 bits) per pixel– Each pixel has three values, each 0-255– Ex. (200, 50, 128) = ?
![Page 107: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/107.jpg)
Color rep’ns
• RGB – system based on light
• CMY – based on printing
• HSB – based on art
• Indexed color – a swatch to save space
![Page 108: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/108.jpg)
RGB system
• Based on primary colors for light
• Each pixel has (red, green, blue) values.
• Examplesblack = (0, 0, 0)
purple = (75, 0, 100)
white = (255, 255, 255)
• How about (x, x, x) or (0, 0, x) ?
![Page 109: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/109.jpg)
CS 16 – Sept. 22
Useful operations (bigger spreadsheets):
– Sort– Filter– Subtotals and Pivot tables– Conditional formatting
![Page 110: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/110.jpg)
Examples
• Climate data• Neighborhood demographics (race, age, density,
income, education)• House listings• Grades given at a law school• Car fuel economy• Store locations• College enrolment, tuition, faculty salaries
![Page 111: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/111.jpg)
Using census data
Level Number Avg size
State 51 5,500,000
County 3,141 90,000
Tract 65,000 4,000
Block group 208,000 1,400
Block 5,000,000 60
![Page 112: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/112.jpg)
Sorting
• Can sort by any column(s).
• Ascending or descending.
• Multiple-column sort to break ties
• Ex. How to sort a list of schools?
![Page 113: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/113.jpg)
A note on sorting
• Sometimes we sort to find the “highest concentration”
• What should we sort by?– values– percentage– surplus / excess
![Page 114: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/114.jpg)
Filtering
• Use filter when you only want to see certain rows.– Ex. Just show me the high schools.
• Can base a filter on – Comparison– Top 10, bottom 10, etc.– 2+ criteria
• Tip: Copy result to another page!
![Page 115: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/115.jpg)
Subtotals
• After sorting, often useful to find subtotal
• Summary function usually “sum”– Ex. School enrollment subtotaled by district.
• Tip: Copy subtotals to another page.
• Trick is to use:
HomeEditingFind&SelectGo To
![Page 116: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/116.jpg)
Pivot Tables
• Perhaps most important feature of Excel!• It’s a 2-D subtotal
– Ex. Find average salary by job & location– Ex. Find total population by state & age
• Allows you to discover subtleties– Ex. How does tuition relate to size of school?– Ex. Is there relationship bet. sugar & caffeine?
![Page 117: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/117.jpg)
Making pivot table
• First, look for 2 columns that may have relationship.
• May need to create vlookup table(s).• No blank rows/columns• InsertTablePivot Table
– Just pivot table. (Can make chart later.)– Put on new page.– Fun to use (just drag…)
![Page 118: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/118.jpg)
CS 16 – Sept. 23
• Finish color representation
• Chapter 4: computer building blocks– Logic gates
– Understanding state transitions
![Page 119: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/119.jpg)
RGB examplesColor R G B
black 0 0 0
white 255 255 255
red 255 0 0
green 0 255 0
blue 0 0 255
cyan 0 255 255
magenta 255 0 255
yellow 255 255 0
![Page 120: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/120.jpg)
CMY system
• Based on primary colors of printing
• Each pixel has (cyan, magenta, yellow) values
• In contrast to RGB:white = (0, 0, 0)
black = (255, 255, 255)
![Page 121: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/121.jpg)
CMY examplesColor C M Y
white 0 0 0
black 255 255 255
cyan 255 0 0
magenta 0 255 0
yellow 0 0 255
red 0 255 255
green 255 0 255
blue 255 255 0
![Page 122: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/122.jpg)
Practical notes
• Printout may look different to screen
• Ex. RGB blue = (0, 0, 255)
but CMY blue = (255, 255, 0)
In other words, in color printer, 2 different toners required to produce blue.
• CMY, a.k.a. CMYK
![Page 123: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/123.jpg)
HSB system
• From artistic standpoint, neither RGB nor CMY makes much sense to people
• More intuitive color definition:– Hue = what color you want– Saturation = how much of that color– Brightness
![Page 124: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/124.jpg)
HSB geometry• Hue = which direction
on color wheel
• Saturation = how far from center
• Brightness = how far up or down
![Page 125: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/125.jpg)
hue
saturation
brightness
Trade-off between saturation and
brightness
![Page 126: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/126.jpg)
Indexed color
• Do we really need 16,777,216 colors?– ~ 200 is more practical
• Indexed color is like RGB:– 6 values of each primary color, not 256– Hex values: 00, 33, 66, 99, cc, ff
• 1 byte per pixel instead of 3
• Dithering to simulate in-between colors
![Page 127: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/127.jpg)
Chapter 4
Begin chapter on computer organization
• Logic gates– Used to perform math operations
• Finite automata– basic model of computation
![Page 128: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/128.jpg)
Logic Gates
• Basic building blocks• Usually 2 inputs• X, Y could be 0 or 1.
1 = true0 = false
• By combining 2+ gates, you get more sophisticated functions
![Page 129: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/129.jpg)
‘AND’ and ‘OR’
AND
X Y ans
1 1 1
1 0 0
0 1 0
0 0 0
OR
X Y ans
1 1 1
1 0 1
0 1 1
0 0 0
![Page 130: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/130.jpg)
Adder
• We can teach the computer how to add using just a few logic gates.
• However, we need to look at one more gate, the XOR.
![Page 131: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/131.jpg)
Exclusive or (XOR)
• XOR basically says “either, but not both”
• The output is 1 if both inputs are different.
XOR
X Y Ans
1 1 0
1 0 1
0 1 1
0 0 0
![Page 132: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/132.jpg)
Adder
• Here is the logic to add, one bit at a time.
![Page 133: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/133.jpg)
CS 16 – Sept. 25
• How computers think– Turing machine model
– Finite state machine model
a.k.a. “Finite automaton”
• But first…. Concept of state
![Page 134: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/134.jpg)
State
• Fundamental concept for any computation– Machine keeps track of where it is, what it needs
– a.k.a. Status, mode
– state may be stored in some memory cell
• Many examples– Logging in
– Using a dialog box, or other user-interface
– Fax machine, photocopier, telephone
– Car transmission
![Page 135: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/135.jpg)
Examples
• In our Tic-Tac-Toe game, the “state” of the game would include:– Whose turn it is
– Is the game over? Who won, or was it a tie?
State is determined by looking at the board.
• Backgammon (roll dice, move pieces…)– Depending on your situation in the game, some moves
are illegal.
• Another way to think about states is to consider all possible board configurations!
![Page 136: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/136.jpg)
Turing machine
• Alan Turing, 1936• Any general purpose machine must:
– Work automatically
– Be aware of what state it’s in
– Have sufficient memory
– Be able to do I/O, and be able to read the input many times if necessary
• Powerful model, but tedious to work with
![Page 137: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/137.jpg)
Adder example
• 4 possible states, depending on the inputs– For example, (S = 0 and C = 0) would be one outcome.
• Programming the details make working with real TMs a headache.
x
y
z
S
C
![Page 138: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/138.jpg)
Finite Automatasingular: finite automaton
• Simple model for machine behavior.• Purpose is to accept or reject some input
– Examples: logging in, using a wizard, game
• At any given time, machine is in some “state”– Start state
– Final (or accept, “happy”) states
– Dead states
• Transitions between states
![Page 139: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/139.jpg)
Example
• Vending machine for 25¢ item.
0 5 10
152025
+5 +5
+5
+5+5
+10+10+25
![Page 140: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/140.jpg)
Binary example
• We want a “word” starting with “101…”
need101
need01
need1
1 0 1
01
0 0,1
![Page 141: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/141.jpg)
Binary Example (2)
• We want a word with at least two 0’s.
needtwo
needone
0 0
1 1 0,1
• What if we wanted exactly two 0’s?
![Page 142: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/142.jpg)
What does this FA do?
A B
1
1 00
![Page 143: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/143.jpg)
Regular language
• Any language that can be “accepted” or recognized by a FA.– Credit card numbers
– Social security numbers
– Phone numbers
– Date / Time (e.g. to enter into reservation system)
• Some FAs are too big to draw, so instead we describe with regular expression.– Shows general format of the input
![Page 144: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/144.jpg)
Regular expression
• The key is to use “wild cards” to make a general expression.
• ? = can replace any single character• * = can replace any number of characters• [ ] = can hold a range of possible valid characters
• Examples101* = anything starting with 101
Sep??.ppt = file names like sep25.ppt or sep04.ppt
furman*.xlsx = any spreadsheet about Furman
![Page 145: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/145.jpg)
CS 16 – Sept. 29
Excel Chapter 5
• Pivot tables
• Alternate file types
• Converting from text file
• Conditional formatting
• Text functions
![Page 146: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/146.jpg)
Pivot Tables
• Perhaps most important feature of Excel!• It’s a 2-D subtotal
– Find average salary by job & location– Find total population by state & age– How many colleges in each state by type
• Allows you to discover subtleties– How does tuition relate to size of school?– Is there relationship bet. sugar & caffeine?
![Page 147: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/147.jpg)
Making pivot table
• First, look for 2 columns that may have relationship.
• May need to create vlookup table(s).• No blank rows/columns• InsertPivot Table
– Select data. (default is usually correct)– Put on new page.– Fun to use (just drag…)
![Page 148: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/148.jpg)
Downloading
• Different file types (and sizes)– xls and xlsx– csv (comma separated values)– txt– zip
• Need to clean up file, because someone else wrote it.
![Page 149: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/149.jpg)
Import text wizard
• For converting .txt to .xls
• Need to tell Excel where columns are:– Delimited by spaces, comma, etc.
or– Specific width (# characters)
• Mistake at this stage is costly (can’t undo).
![Page 150: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/150.jpg)
Excel’s text functions
• Excel can do more than numbers.
• Text functions extract part of string:– left( ), right( ), mid( )– search(): find where something is in a string
• Ex. Processing win/loss records
• Ex. Separating first & last names.
![Page 151: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/151.jpg)
Examples
Suppose d7 = “(305)555-8050”=search(d7, “)”) would return 5
=left(d7,5) would return “(305)”
=right(d7, 5) would return “-8050”
=mid(d7, 6, 3) would return “555”
In a spreadsheet, we may want to filter phone numbers by area code
![Page 152: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/152.jpg)
CS 16 – Sept. 30
Chapter 5• CPU and memory
– Carry out instructions from software.
• John von Neumann’s ideas– Keep program stored in memory
– How to execute each instruction routinely
• Performance
![Page 153: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/153.jpg)
Instruction execution
CPU is workhorse – memory holds program
• Fetch instruction from memory (to CPU)
• Decode – figure out what kind of inst.
• Execute – do it
• And then go on to next instruction
![Page 154: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/154.jpg)
Performance units
Time (clock period) Speed (clock rate)
Second 1 sec Hertz (Hz) 1 Hz
Millisecond (ms) 10-3 sec Kilohertz (KHz) 103 Hz
Microsecond (μs) 10-6 sec Megahertz (MHz) 106 Hz
Nanosecond (ns) 10-9 sec Gigahertz (GHz) 109 Hz
![Page 155: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/155.jpg)
Execution Time
• Need to know:– # instructions that execute– Clock cycles per instruction (CPI)– Clock rate (cycles per second)
![Page 156: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/156.jpg)
Formula
• Ex. How long will a program take to run if it executes 1 million instructions, the CPI is 4 cycles per inst., and the clock rate is 1 GHz?
sec/10
)/4(*)10(9
6
cycles
instcyclesinsttime
mstime 4sec10*4 3
sec/
)/(*)(#
cycles
instcyclesinsttime
![Page 157: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/157.jpg)
Performance
• Execution time. Need to know:– # instructions that execute– Clock cycles per instruction (CPI)– Clock rate (cycles per second)
• Formula:
sec/
)/(*)(#
cycles
instcyclesinsttime
![Page 158: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/158.jpg)
Example
• How long will a program take to run if it executes 1 million instructions, the CPI is 4 cycles per inst., and the clock rate is 1 GHz?
sec/10
)/4(*)10(9
6
cycles
instcyclesinsttime
mstime 4sec10*4 3
![Page 159: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/159.jpg)
Improving performance
• To reduce time, we can:– Run fewer instructions– Take less time for each instruction– Faster clock We’ll look at this
• Marketing can cheat!
sec/
)/(*)(#
cycles
instcyclesinsttime
![Page 160: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/160.jpg)
• How many cycles to execute 7 instructions?
Cycle F D X
1 1
2 1
3 1
4 2
5 2
6 2
7 3
8 3
9 3
![Page 161: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/161.jpg)
Cycle F D X
1 1
2 2 1
3 3 2 1
4 4 3 2
5 5 4 3
6 6 5 4
7 7 6 5
8 7 6
9 7
Better approach:• Technique is called
“Pipelining”
• On each cycle, try to do several jobs at once.
• Like an assembly line.
![Page 162: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/162.jpg)
Pipelining the CPU
• CPU consists of parts: fetcher, decoder, executor, etc.
• Without pipelining,
total cycles = (# inst) * (CPI)
• With pipelining,
total cycles = ? (Hint: do first instruction; then handle the rest)
![Page 163: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/163.jpg)
Example
• How many cycles are needed to execute 50 instructions, given that the CPU uses 4 stages? [Fetch, decode, execute, writeback]
4 cycles for the first instruction1 cycle for each of the rest4 + (50 – 1) = 53 cycles
• CPI = 53 cycles / 50 instructions = 1.06
![Page 164: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/164.jpg)
Stalls• What if instruction 2 needs more time?
During cycle 5, instruction 3 has to wait.
Cycle F D X W
1 1
2 2 1
3 2 1
4 2 1
5 2
6 2
![Page 165: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/165.jpg)
Cycle F D X W
1 1
2 2 1
3 3 2 1
4 4 3 2 1
5 4 3 2
6 4 3 2
7 5 4 3 2
8 5 4 3
9 5 4
10 5
![Page 166: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/166.jpg)
Deli pipeline!
• Five stages in deli to make sandwich:– Place order– Get right bread and slice– Put meat on bread– Add condiments– Cashier and pickup.
• What are some possible stalls?
![Page 167: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/167.jpg)
Summary
• Time = total cycles / clock rate
• Is machine is pipelined?– If no, cycles = (# instructions) * (CPI)– If yes, cycles = # stages + # inst – 1 + stalls
• Simultaneous stalls
• With pipelining, CPI is almost 1. – Can we do better than this?
![Page 168: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/168.jpg)
CS 16 – Oct. 6
• Web query
• Decision-Making– Scenarios– Goal seek– Solver
Work on chapter 8
![Page 169: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/169.jpg)
Web Queries
• Very often, we want to manipulate data we find on the Web.
• Excel can grab a table from a Web page and convert it to a spreadsheet!
• Data Get External Data From Web
![Page 170: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/170.jpg)
Scenario Manager
• Allows you to change several cells at once
• Scenario summary: see all scenarios.
• Ex. We can look at “grade” demo again.
![Page 171: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/171.jpg)
Goal Seek
• I want a $500 payment.
• Goal seek can find the input loan amount.
![Page 172: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/172.jpg)
Solver
• Similar to Goal Seek, but multiple input cells
• Example: a factory that makes cookies needs to produce just the right mixture of cookies to maximize profit.– Constrained by supplies of raw materials.
![Page 173: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/173.jpg)
CS 16 – Oct. 7
• Finish chapter 5: Memory– Main memory– Secondary memory
![Page 174: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/174.jpg)
Memory system
• After the CPU, next most important feature
• CPU contains registers – only enough for immediate calculations
• Main memory – running programs
• Secondary memory – long-term storage– “open” vs. “save”
![Page 175: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/175.jpg)
Main memory
• Runs on electricity: “volatile” but fast
• Principle of random access
• Examples:– RAM (vast majority of main memory is here)– Cache (small version of RAM, much faster)– BIOS (“Basic I/O System”)
![Page 176: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/176.jpg)
Secondary memory
• Non-electric, “non-volatile” technologies– Magnetic– Optical
• How to find information? It may be:– Random access (e.g. flash memory; stick)– Direct access (disk)– Sequential access (tape)
![Page 177: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/177.jpg)
Example comparison
Type Size Access time
Cost per MB
CPU regs 256 bytes 1 ns Forget it.
Cache 16 KB 2 ns $ 20
RAM 128 MB 20 ns $ 1
disk 100 GB 100,000 ns $ .001
![Page 178: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/178.jpg)
Disk examples
• Hard drive– Can’t take out. Don’t confuse with RAM
• Floppy disk– 8” , 5 ¼”, 3 ½”
![Page 179: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/179.jpg)
Disk examples
• ZIP disk, “super” disk
• CD (including: CD-ROM, CD-R, CD-RW)– “ROM” = read-only– “R” = recordable– “RW” = read/write
• DVD
![Page 180: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/180.jpg)
Disk geometry
• Tracks
• Sectors
• Platters
![Page 181: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/181.jpg)
Access time
• Seek time – wait to find right track (~ 8 ms)– Head moves at 50 mph!
• Latency – wait to rotate (~ 4 ms)– Based on 7200 RPM
• Transfer – grab data from track
![Page 182: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/182.jpg)
Example: the CD
• Each track has lands and pits.
• 700 MB total, including overhead
• About 25,000 tracks
• About 50 sectors per track
• One bit = about 1.6 microns long,
0.7 microns wide
![Page 183: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/183.jpg)
CD speed
• Nominal speed is 80 mins (150 KB/sec)
• Ex. 12x speed, ~ 7 mins (1.7 MB/sec)
• By comparison, a floppy takes about
100 times slower: (1 MB/min)
• Fragmentation can ruin time!
![Page 184: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/184.jpg)
Flash memory
• Stores electric charge w/o need for electricity
• Usually faster than disk, but varies:• For one KB:
– 0.065 ms to read– 1.5 ms to write
• Thus, per second:– 15 MB/sec to read– 0.6 MB/sec to write
![Page 185: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/185.jpg)
Magnetic Tape
• Compact, about size of microcassette
• Typical capacity 8 GB– Has horizontal tracks
• Takes about 4 hours to “wind”(similar speed to magnetic disk)
• Used for routine/automatic backups
![Page 186: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/186.jpg)
Experiment
How long does it take to move a 20 MB file?
Media Write to Read from
Zip disk 3:00 0:20
CD-RW 2:00 0:20
Flash 0:14 0:02
RAM 0:01 0:01
LAN server 0:04 0:04
External drive 0:03 0:02
![Page 187: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/187.jpg)
CS 16 – Oct. 13
Databases (Microsoft Access)
• 4 parts of a database
• database design– Try to understand the ideas behind database
design, not just the mechanics.
![Page 188: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/188.jpg)
Access vs. Excel
• Excel emphasizes numbers
• Access emphasizes relationships
• some overlap
• Access is perfect for finding common info from 2 separate tables
![Page 189: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/189.jpg)
Purpose of Access
• It’s a “database management system”
• Record keeping for a business– Requires a plan– one file, with many components
• Keep track of … so that:– Find cross-references– Generate reports
![Page 190: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/190.jpg)
Database format
Usually four parts:
• Tables (at least 1 is required)
• Queries
• Forms
• Reports
![Page 191: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/191.jpg)
Navigating a table
• A database table looks like a spreadsheet!
• Record = row
• Field = column
• Two ways to view:– Design view, to start– Datasheet view, to enter data
• Primary Key!
![Page 192: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/192.jpg)
Example questions
• In a stock portfolio:– Which stocks have lost money?– When did I buy those stocks?
• Which class is easier: CS 22 or CS 25?– Check grades in each class– Check grades for students who’ve taken both
• Among customers who bought a new generator last year, what have they bought since?
![Page 193: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/193.jpg)
Relieve tedium
• Suppose we want to maintain info on orders.
• Better to have two tables than one!
Order# Name City State Product Qty.
101 J. Miller Miami FL Laptop 5
102 G. Novak Tampa FL Printer 3
103 G. Novak Tampa FL DVD-RW 50
104 G. Novak Tampa FL Keyboard 1
105 J. Miller Miami FL Lamp 4
106 A. Bik San Diego CA Chair 6
107 T. Lee Buffalo NY Fan 3
![Page 194: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/194.jpg)
Need multiple tables
• Ex. Librarian wants to contact graduating seniors who have overdue books.
• Need multiple tables:– Student info table
• Student #, name, year
– Book table• ISBN, title, author, …
– Transaction or “check out” table• Transaction #, ISBN, student #, Due date
![Page 195: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/195.jpg)
Relationships
• When you have 2+ tables, there is almost always a relationship
• They share one field in common.– Can you tell what it is?
• Ex. Customers & Orders• Ex. Students & Class roster• Ex. Publishers & books
![Page 196: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/196.jpg)
Animal hospital
• Keep track of customers, pets, visits
• Each gets its own table– What fields for each table?– Relationships
• What else does a database need?
![Page 197: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/197.jpg)
Relationships
![Page 198: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/198.jpg)
Fields in your table
• Anticipate questions– Age? store birth date– GPA? store credits and quality points– What year? store date of admission
• Store data in its smallest parts (e.g. address)
• Calculated fields don’t belong in table!
![Page 199: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/199.jpg)
CS 16 – Oct. 14
Computer problem solving
Chapter 6: read pp. 148-174
• Problem-solving procedure
• Structure of a solution
• Examples!
![Page 200: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/200.jpg)
Review: what is CS ?• The study of how we …
– Solve problems
– Represent information
• In problem solving, we’d like:– Find systematic ways of going about solution
– Correct, quick and informative solutions.
• Information can be:– Different types: numbers, text, images, sound, the software
itself
– The input and output to a computer program
![Page 201: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/201.jpg)
Why create software?
• Computational power– Excel is limited to so many rows/columns
– Can convert data to images
– Can create games and useful applications
– With one “language”, can solve virtually any problem.
• Built-in features of languages– Many common calculations are pre-defined for you
such as sorting, opening files, surfing the Web, creating a button, etc.
![Page 202: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/202.jpg)
Software• Powerful!
– We get to tell the machine exactly what we want.
– Sometimes, existing programs like Excel or Photoshop are not enough.
• Program = sequence of instructions for CPU to obey.– Works like a recipe.
– A recipe has: ingredients, steps, and result is food!
– A program has: input, calculations, output. When we start to look at programs, be on the lookout for these 3 parts.
![Page 203: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/203.jpg)
Recipes
• Cooking may be a good analogy, because it’s solving a specific problem “I’m hungry.”
• What do we see in recipes? Here’s one:– Brown the beef 15 min. Drain grease.
– Dice carrot, celery, onion (aka “mirepoix”)
– Cut up and boil 6 potatoes until soft.
– Mash potatoes
– Add flour, spices, sauce, mirepoix to beef.
– Put meat mixture into casserole, top with potatoes.
– Bake in oven at 400 for 30 minutes.
![Page 204: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/204.jpg)
Recipes (2)
• A computer program has some of the same elements as a recipe…
• In recipes we see:– Ingredients (the “nouns” of the problem)
– Steps to perform (the “verbs”)
– In some steps, we continue/wait for something
– Although it’s not obvious, sometimes we check things:• Are potatoes fully mashed?
• Should I add more _____ to the mixture?
![Page 205: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/205.jpg)
Recipes (3)• But we don’t eat the same stuff every day. Once we
know a few recipes, we can put together a menu for choices.
if (have all ingredients), make Shepherd’s pie.
if (no potatoes), just make soup instead.
if (no veggies), make hamburger.
if (no beef), make pasta.
• When you view a whole menu as a program, then “making soup” becomes a sub-program.– A large program is composed of several parts.
– In industry, sometimes each part implemented by different people. A kitchen may have many chefs.
![Page 206: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/206.jpg)
Problem-solving
1. Understand problem; inputs and outputs
2. Write solution in English “pseudocode”
3. Write code in a programming language
4. Compile
5. Run and test
• When program works, can refine.
![Page 207: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/207.jpg)
Problems• The earliest problems given to a computer were
mathematical.• Sometimes there is no clean formula
– Many equations can’t be solved analytically. For example, cos(x) = x. Need to solve numerically.
– Ex. Heat equation is a partial differential equation (PDE). Most PDEs have to be solved numerically.
– Ex. Calculating a square root.
• And even if there is a clean formula, a computer can help you automate the calculations.
![Page 208: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/208.jpg)
Problems (2)• “Mathematical” problems may at first sound boring.
But they include many useful applications– Ex. Finding directions
• Other kinds of problems for the computer– Games
– Record keeping, managing investments, …
– Networking, communication
– Multimedia (e.g. image processing)
– Of course, much more!
![Page 209: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/209.jpg)
Example problems
• How would you solve these problems?– Print the numbers from 1 to 10.– Searching for something.
• In this list (3, 2, 7, 5, 4) where is the number 5?• Which room contains my umbrella?
– Play Tic-Tac-Toe.
• Idea for solution (algorithm) is more important than typing code at the keyboard.
![Page 210: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/210.jpg)
Computer program
• Sequence of instructions that machine carries out
• Nouns and verbs
• Structure:– Input, calculations, output– Auxiliary functions
![Page 211: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/211.jpg)
Kinds of statements
• Get input
• Print output
• Assign value to variable
• If-else
• Loop
![Page 212: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/212.jpg)
Summary• Computer science is a problem-solving discipline.
• Every solution (program) should have a well-defined structure, such as listing the ingredients and steps for input, calculations and output.
![Page 213: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/213.jpg)
CS 16 – Oct. 16
• Solving simple problems: create algorithm• Structure of solution
– Sequence of steps (1,2,3….)
– Sometimes we need to make a choice
– Sometimes we need to repeat some steps
• Examples
![Page 214: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/214.jpg)
Algorithm
• Clear sequence of steps to arrive at a solution to a problem. Must specify:– Input, output, variables and operations used
– The order in which the steps are taken
• Ideally, each step should perform one calculation:– Input or output of one value
– One calculation, or decision to make
– Calculations usually limited to basic math
– Tedious details can be put off until later.
![Page 215: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/215.jpg)
Structure
Steps can be hierarchical (nested):
for (day = 1 to 365)
if (Saturday or Sunday) stay home else
1. eat breakfast2. for (hour = 8 to
16.30) work
3. eat dinner
![Page 216: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/216.jpg)
Examples
• Algorithm to add two numbers– Ask the user to enter 2 values– Obtain the input, and call the values a and b.– Set a new variable sum and set it to: sum = a + b.– Output sum.
• Calculate weekly wage. √– Get hours and rate from the user.– Set the wage as follows:
• If (hours > 40), use overtime formula• Otherwise, use regular formula
– Output wage
![Page 217: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/217.jpg)
Loop example
• Add up the numbers from 1 to 5– No input!– Need 2 variables: sum and counter.
• The counter variable will go from 1 to 5, one at a time.• The sum will start at 0, and we will continually add to the sum.
– Sum = 0 and counter = 1– For each value of counter from 1 to 5:
• Sum = sum + counter
– Output sum
• If we can add 1-5, we can just as easily add 1-1000!
![Page 218: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/218.jpg)
Mystery
• What does this algorithm do?– No input.– Create two variables: sum and counter.
Start sum = 0 and counter = 1– For each value of counter from 1 to 20:
• Introduce new variable called temptemp = counter * counter
• Sum = sum + temp
– Output the sum
![Page 219: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/219.jpg)
CS 16 – Oct. 21
• Computer program – Chapter 8 in book (skip chapter 7)– I/O can take various forms– Programming languages
• Examples: Javascript
![Page 220: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/220.jpg)
I/O• A program’s input may be:
– Numbers
– Text
– File
– Button / click
– Image (rarely)
– Sound (rarely)
• A program’s output may be:– Numbers
– Text
– File
– Image
– Sound (rarely)
A computer program can read and create files, interact with the Web, and create images & other multimedia.
![Page 221: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/221.jpg)
Evolution of programming
• Machine language• Assembly language
– Unique to each manufacturer
• High-level language– FORTRAN, COBOL– Pascal, Algol, Ada– C, C++– Java, Javascript
![Page 222: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/222.jpg)
Example
• How would we calculate:
12 + 22 + 32 + … + 202 ?
• Let’s create our own solution, and see what the “code” looks like in different languages:– Machine language – Assembly language – High-level language
![Page 223: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/223.jpg)
Machine language
00003000: 00000014
00004000: 200c0001
00004004: 20080000
00004008: 3c0a0000
0000400c: 354a3000
00004010: 8d4a0000
00004014: 018a4822
00004018: 1d200005
0000401c: 018c0018
00004020: 00005812
00004024: 010b4020
00004028: 218c0001
0000402c: 08001005
00004030: 2008000a
00004034: 0000000c
help me!
![Page 224: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/224.jpg)
Assembly language
numValue: .word 20
__start:
addi $12, $0, 1
addi $8, $0, 0
lui $10, 0
ori $10, $10, 0x3000
lw $10, 0($10)
while:
sub $9, $12, $10
bgtz $3, end
mult $12, $12
mflo $11
add $8, $8, $11
addi $12, $12, 1
j while
end:
addi $8, $0, 10
syscall
![Page 225: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/225.jpg)
HLL (Pascal)
var
sum : integer;
count : integer;
begin
sum := 0;
for count := 1 to 20 do
sum := sum + count * count;
writeln(sum);
end.
![Page 226: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/226.jpg)
Some languages
• C++ is a general-purpose language.– Especially good for simple tasks.
• Java: lot’s of built-in features – Graphics, automatically surf web
• JavaScript language useful with HTML.– We’ll look at examples.
![Page 227: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/227.jpg)
Javascript
• Can write simple programs little/no overhead or prior experience
• Purpose of JS is to give “life” to Web pages.• Works with a Web browser
– First, create HTML file using a text editor.
– Refresh the browser when you make a change.
• Online guide– http://www.w3schools.com/js/js_examples.asp
![Page 228: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/228.jpg)
HTML format
• Web browsers read HTML files.
<html>
<meta> ... </meta>
<body> ... </body>
</html>
• Meta section is optional• Body contains material to appear in browser
window.
![Page 229: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/229.jpg)
Minimal example
• The simplest Web page contains text.– Can format with various font commands …
• To insert Javascript code, put inside the body:<script type=“text/javascript”> ... </script>
<html><body> Hello!</body> </html>
![Page 230: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/230.jpg)
Simple JS features
• Printing a message– <br> means break to the next line
– <h1> is a heading level – prints big & bold
• Using variables• Looking up time• Making choices• Loop
![Page 231: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/231.jpg)
Example
• We can ask the browser what time it is, and then print it out.
var d = new Date();
var hour = g.getHours();
...
• How would we show…– another time zone?
– digit 0’s correctly?
– am/pm ?
![Page 232: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/232.jpg)
CS 16 – Oct. 23
• Software problem solving – Process– Uh-oh’s– General examples
• Javascript– Fixing the time program– Revisit earlier examples
![Page 233: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/233.jpg)
Process
• The “usual” procedure for writing a program from scratch involves these steps:– Read & understand the problem
– Explain how to solve the problem in English.
– Write solution in the desired programming language
– Compile the program• Compiler produces an executable file.
– Run the program, check the output.
![Page 234: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/234.jpg)
Bugs
• Any mistake in a computer program
• Coined by Grace Hopper, ca. 1950.
• Three kinds of bugs:– Syntax errors– Run-time errors– Logical errors
• Beyond bugs, program can be just slow!– Ex. Finding the divisors of some number.
![Page 235: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/235.jpg)
Javascript practice
• Time program– Need to print extra 0 in case of “10:05”. We don’t
want 10:5
– How would we convert to a different time zone?
• 2nd example shows how we can solve our earlier practice problems.– Repetition using a loop
– Storing multiple values in an array
![Page 236: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/236.jpg)
CS 16 – Oct. 27
Databases
• How tables work
• Relationships– Queries without relationships– 3 kinds of relationships– Practice
![Page 237: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/237.jpg)
Table review
• We want to “manage” information:– Organize, insert, delete, retrieve
• To organize we…– Create a table (or “set”, “class”)
consisting of records (or “objects”)each having fields (or “attributes”)
• Usually we’ll want 2+ related tables.
![Page 238: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/238.jpg)
Queries
• Usually we ask about info from 2+ tables.• By default, a query will perform an operation
called a Cartesian Product, which gives all possible combinations.
• Ex. Name and City tables:
Name
Bob
Mary
Ken
City
Miami
Pittsburgh
![Page 239: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/239.jpg)
Cartesian Product
• Given 2 sets, find all possible ordered pairs.– Analogously for more than 2 sets.
• Great example: choosing a menu.– Appetizer– Entrée– Dessert
• Unfortunately, most DB queries are not like this! We get too many results.
![Page 240: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/240.jpg)
Relationships
• We want to tell Access that there is a relationship between the tables, so we can create meaningful query.
• One-to-many is most common– “Each city has one or more employees.”– Now, query will return 3 results instead of 6:
Miami BobPittsburgh Mary
Ken
![Page 241: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/241.jpg)
One-to-One
• Can be useful if some information is confidential.
• What if we didn’t have any relationship?
Empl # Name Position
101 Smith Welder
102 Jones carpenter
Empl # Salary
102 18,000
101 17,000
![Page 242: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/242.jpg)
1-1 Query
• When you combine tables that have a 1-1 relationship: Access will look for fields that are the same, and use this as a filter.– In previous example, we’ll have 2 results
instead of 4. Employee 101’s informationEmployee 102’s information
– Let’s look at another example.
![Page 243: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/243.jpg)
• What happens when we “join” these 1-1 tables?
First name Last name Position City
Bob Fuller accountant Chicago
Bob Daniels cashier Greenville
Bob Daniels accountant Indianapolis
Alice Andrews gardener Greenville
First name Last name Salary Birthday
Bob Daniels 51,000 7/1/67
Elena Carlson 21,000 9/1/89
Alice Andrews 81,000 8/1/78
![Page 244: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/244.jpg)
First Last Position City Salary Birthday
Bob Daniels cashier Greenville 51,000 7/1/67
Bob Daniels accountant Indianapolis 51,000 7/1/67
Alice Andrews gardener Greenville 81,000 8/1/78
First name Last name Position City
Bob Fuller accountant Chicago
Bob Daniels cashier Greenville
Bob Daniels accountant Indianapolis
Alice Andrews gardener Greenville
First name Last name Salary Birthday
Bob Daniels 51,000 7/1/67
Elena Carlson 21,000 9/1/89
Alice Andrews 81,000 8/1/78
![Page 245: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/245.jpg)
One-many Relationships• Referential integrity
– Keep related records consistent
– Cascade delete: allow deletion of “one”
– Cascade update: allow update of “one”• For example, changing someone’s CustomerID.
![Page 246: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/246.jpg)
Many-to-many
• Ex. Customers to products
• Implement as 2 one-to-one
• “Order details” table
• Think of possible queries based on the 5 tables given in handout.
![Page 247: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/247.jpg)
Other queries
Besides ordinary “select” queries:
• Total – special case: also do subtotals • Parameter – prompt user to tailor the result
• Action – modify underlying table– Make, delete from, append to, update
• Crosstab – 2-D subtotal– Ex. $, by species and month!
![Page 248: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/248.jpg)
CS 16 – Oct. 28
The Joy of Text
• Software for text– Text formatters vs. word processors
• Spell checking
• Readability
• Fonts
![Page 249: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/249.jpg)
Text Software
• Text editor (Notepad, Wordpad, emacs, vi)
• (Web) Browser (Netscape, Opera)
• Text formatter (LaTeX, Groff)
• Word processor (MS Word)
![Page 250: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/250.jpg)
Text Formatters
• Groff was first in 1969
• LaTeX most popular since 1974
• Used extensively in scientific pub’s
• Formatting commands embedded in text.
• Run “latex” to convert .tex to .ps file
• Advantages: free & saves space!
![Page 251: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/251.jpg)
Word Processors
• Popular among general public since 1980s.
• WYSIWYG– Formatting commands are invisible
• Entire document in 1 file
• Many features: spell checking, word count, readability, etc.
• Not free, generally requires more space.
![Page 252: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/252.jpg)
Example
• My vita is a 2-page document
• LaTeX– vita.tex has 4,210 bytes– vita.ps has 43,675 bytes (can delete!)
• Microsoft Word– vita.doc has 31,232 bytes
![Page 253: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/253.jpg)
Spell Checking
• One feature of MS Word is spell checking
• Looks up each word in its “dictionary”
• Uses binary search to make lookup fast!
• Analogy: Try to guess my number 1-100.
![Page 254: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/254.jpg)
Binary Search
• If dictionary has 100 words, need 7 guesses to see if word is spelled right.
log2 100 ~ 7
• What if 1,000 words?
• A real dictionary may have > 25,000 words.
![Page 255: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/255.jpg)
Example
• Looking for “goat”. Here are guesses:
Joachin, degumming, gale, holly, guideline, gloomy, granite, golly, gnu, …
• Notice they go back and forth.
![Page 256: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/256.jpg)
Readability
• First, need to measure:– Words per sentence– Syllables per word
• How to Write Plain English by Flesch:206.835 – 84.6*spw– 1.015*wps
90’s = fifth grade
30’s = college level
![Page 257: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/257.jpg)
Fonts
• Font = style of printing– Typeface– Point size– Ex. Times 10, Helvetica 12
• Fonts can be distinguished by– Sarif or sans sarif– Proportional or non-proportional
![Page 258: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/258.jpg)
Font types
• Sarif = has feet
• Sans sarif = no feet– Look at: i, h, n, r, … (but not t!)
• Proportional = width of characters changes• Non-proportional = all have same width
![Page 259: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/259.jpg)
CS 16 – Oct. 30
• Text vs. Hypertext
• Web terminology
• Domains
• HTML
![Page 260: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/260.jpg)
Hypertext
• A text document that contains links to other documents.
• Also may contain “multimedia”
• Filename *.html
• Software: editor…browser.
![Page 261: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/261.jpg)
Some terminology
• Internet = global “network of networks”
• Some Internet applications:– WWW = linked documents on the Internet– E-mail– chat– FTP = file transfer prototcol
![Page 262: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/262.jpg)
Web terminology
• HTML = standard language for hypertext
• Web page = hypertext document (*.html)
• Web site = collection of pages & folders usually starting with index.html
• Web server = machine containing site
• Web browser = program that interprets HTML to show on screen
![Page 263: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/263.jpg)
Web addressing
• Location of file is given by a Web address or URL.
http://www.seds.org/billa/tnp/saturn.html
• saturn.html = page
• billa/tnp = folders
• www.seds.org = site [ server.place.domain]
![Page 264: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/264.jpg)
Domains
• Three letter for U.S. (.com, .org, .net, .edu, .mil, .gov)
• Two letter for countries (.ca, .uk, .za, .ch, .de, .is, cn, .at, .us ………)
• Beware of exceptions
• Newer domains (.info, .museum, .biz, …)
![Page 265: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/265.jpg)
Making Web pages
• Web pages written in HTML. 2 ways…
• Type in HTML code in text editor.– Enter “tags” as you go.
• Use “web generator” such as Dreamweaver– WYSIWYG
![Page 266: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/266.jpg)
Common tags
• h1, h2, etc. = headings
• br = line break
• p = paragraph
• ol, ul, li = used for lists
• hr = horizontal rule
• b, i = bold or italic
• sub, sup = subscript or superscript
![Page 267: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/267.jpg)
Examples
• 7 <sup> th </sup>
• Who wrote <i> Das Rheingold </i> ?
• <ul>
<li> Gold </li>
<li> Silver </li>
<li> Bronze </li>
</ul>
![Page 268: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/268.jpg)
Web Browsers
• Mosaic, Netscape, Opera, Mozilla, lynx, …
• Opera features:– Mouse gestures– Tabs– +/– keys– Shift-F6 to tile [ ctrl-shift-F5 to un-tile ]
• Rivalry with IE
![Page 269: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/269.jpg)
Web Surfing
• Type in URL (if you know it)
• Start with index site
• Search engine– Quotes “swan lake”– Minus waterloo –university
• Example results
![Page 270: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/270.jpg)
Some sites
• world.altavista.com
• terraserver.microsoft.com– (Screen dump to capture image)
• factfinder.census.gov
• www.htmlhelp.com
• http://www.alexa.com
• Sites that show your IP address…
![Page 271: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/271.jpg)
Privacy & Cache
• Hmmm, different browsers & versions behave slightly differently….
• In Opera, hit F4. You’ll see:– history– list of links
• Other things– security on site (https:// or .shtml)– where it’s cached– Where are cookies stored ?
![Page 272: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/272.jpg)
Web issues
• Check date of article
• Check for corroborating info
• Mistakes & bias
• Some things harder to find on the Web?
• Internet quite powerful when you combine 2+ sites or programs– Ex. Searching for airfares, hotel rooms
![Page 273: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/273.jpg)
Scavenger hunt• Looking for a house…
– Real estate Website to find listings– Google earth to look at house & lot– Mapquest to find nearest school, stores
• Media bias– Google news collects headlines– Is the set of “news sources” biased?
• International issues– In some countries, Internet access is restricted!– Languages other than English
![Page 274: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/274.jpg)
CS 16 – Nov. 4
• Questions about homework?
• Surfing the Web (continued)
• Web issues and searching
![Page 275: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/275.jpg)
Some sites
• world.altavista.com
• maps.live.com
• factfinder.census.gov
• www.htmlhelp.com
• www.alexa.com
• nces.ed.gov/ipeds
• www.getaway.co.za
![Page 276: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/276.jpg)
Privacy & Cache
• Different browsers & versions behave slightly differently….
• Issues– security on site (https:// or .shtml)– browser cache– cookies
• Browsing anonymously– www.anonymouse.org– ads based on your location
![Page 277: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/277.jpg)
Web issues
• Check date of article
• Check for corroborating info
• Mistakes & bias
• Some things harder to find on the Web?
• Internet quite powerful when you combine 2+ sites or programs– Ex. Searching for airfares, hotel rooms
![Page 278: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/278.jpg)
Scavenger hunt• Looking for a house…
– Real estate Website to find listings– Google earth to look at house & lot– Mapquest to find nearest school, stores
• Media bias– Google news collects headlines– Is the set of “news sources” biased?
• International issues– In some countries, Internet access is restricted!– Languages other than English
![Page 279: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/279.jpg)
CS 16 – Nov. 6
Interactive Web pages
• Javascript: responding to a prompt– See handout
• Dreamweaver– Navigation bar
– Jump menu
– Hotspots in an image
![Page 280: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/280.jpg)
CS 16 – Nov. 11
• Organizing Web content
• Javascript forms
![Page 281: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/281.jpg)
Link review
• Text or images can be a link • Navigation bar
– Click on a rollover image
• Jump menu– Easier to construct
• Hotspot within an image!
![Page 282: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/282.jpg)
Organizing content
• Tables – big box with cells
• Frames – ability to see multiple HTML files– Can have scroll bars
• Layers – give you most freedom– Can overlap– Good to hold images
![Page 283: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/283.jpg)
Javascript forms
• Interactive I/O• User types inside a text box or text area, and clicks
a button to “submit” answer.• A function “validates” or does some computation.
Can announce answer in an “alert” box.
• Examples (handout)
![Page 284: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/284.jpg)
CS 16 – Nov. 18
Operating Systems
• Ultimate program
• Intimate with the hardware
• Responsibilities…
• Examples
![Page 285: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/285.jpg)
Operating Systems
• Computer is like a 3-story building• OS manages the whole machine;
interfaces with us.
Applications
Operating System
Bare hardware
![Page 286: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/286.jpg)
OS Manages…
• logins, logouts, passwords• multitasking• memory• files• I/O• user interface• security
![Page 287: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/287.jpg)
Passwords
• Login: username & password
• Password security– Many combinations– Penalties for mistake– Password file is encrypted
![Page 288: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/288.jpg)
Resources
• Need to manage printer, files, etc.
• Synchronization– Ex. 2 machines want to print at same time– Ex. Copy a file that’s currently in use
– Detect if available– Need to temporarily “lock” the resource
![Page 289: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/289.jpg)
Multi-tasking
• Defn – doing multiple things at once
• Practical defn – make it appear as though…
• Time quantum (0.1 sec)
• Processes take turns using the CPU
![Page 290: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/290.jpg)
Memory mgmt.
• RAM is much faster than disk, but smaller• OS determines what belongs in RAM
• When RAM gets crowded, less-used files sent back to disk.– Like a small kitchen counter that can’t hold all your
recipe’s ingredients.
• Thrashing
![Page 291: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/291.jpg)
File mgmt.
• For each file/folder, OS knows:– Name– Size– Type ( icon and what program to open)– Owner– Group– Permissions
• In multi-user system, users may have quota.
![Page 292: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/292.jpg)
CS 16 – Nov. 20
Operating Systems
• Ultimate program
• Intimate with the hardware
• Responsibilities…
• Examples
![Page 293: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/293.jpg)
File permissions
• 3 levels: owner, group, rest of world
• For each level– ‘r’ = can I read the file?– ‘w’ = can I write to (or delete) the file?– ‘x’ = can I execute the file?
• Ex. rw-rw-r-- (664)• Ex. rwxr-xr-- (754)
![Page 294: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/294.jpg)
Common permissions
• Most of the time, we don’t use “groups,” so the group permission = everybody else
644
600
755
700• Only owner* can change permissions
![Page 295: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/295.jpg)
Processes
• A process is an executing program.• OS must keep track of all the work it’s doing, in
case of interruption (e.g. hibernate mode).• Possible states for process (p. 338)
– Ready (could execute, but doesn’t have CPU)
– Running (in CPU)
– Waiting (doing I/O operation)
![Page 296: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/296.jpg)
Process scheduling
• Extensively studied in CS !• Look carefully at examples pp. 340-342.
• 3 common techniques– Round robin (we saw this one already)
– First-come, first-served
– Shortest Job Next
![Page 297: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/297.jpg)
Scheduling
• Round-robin– Fair: give each process an equal time quantum.
– Usually not long enough to finish, so pre-empt. Pre-emption incurs some overhead, so there are alternative strategies:
• First-come first served– Do the tasks in the order in which they are requested
• Shortest job next– Try to minimize the average completion time. Do the
easy/short tasks first.
![Page 298: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/298.jpg)
Measuring a schedule
• To tell how good a schedule is, we can compute the average turnaround time.– People are usually interested in how long it takes for
their jobs to get done.
– Turnaround time = (time @ finish – time @ request)
![Page 299: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/299.jpg)
Example
Process number Time of request (ms) Execution time needed
1 0 20
2 5 30
3 10 40
4 20 10
First-come, first-served:Process 1 can execute from t=0 to t=20Process 2, t=20 to t=50Process 3, t=50 to t=90Process 4, t=90 to t=100
What is the average turnaround time?
![Page 300: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/300.jpg)
Popular OS’s
• 1971 UNIX, Linux
• 1979 DOS
• 1983 Microsoft Windows
• 1984 MacOS
• 1980 QNX (a real-time OS)
![Page 301: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/301.jpg)
Cutting Edge
• Real-time OS– Assumes all jobs have deadlines
• Distributed OS– Your running program and/or files may be on a
different machine
• High Performance Computing– Using multiple CPUs at once– Technique is called “parallel processing”
![Page 302: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/302.jpg)
![Page 303: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/303.jpg)
CS 16 – Nov. 25
Enhancing images
+/- brightness
+/- contrast
![Page 304: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/304.jpg)
Filter function
• Input = original image (x)
• Output = final image (y)
f
![Page 305: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/305.jpg)
Brighten
• To brighten, we increase pixel values.
• Simple function like y = x + 20 won’t work
• Real filter functions have complex formulas– Better to “draw” the filter function
![Page 306: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/306.jpg)
Filter function
• Axes for input and output pixel values
0 2550
255
0 2550
255
![Page 307: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/307.jpg)
Brighten
• We want output > input.
0 2550
255
0 2550
255
brighter
darker
![Page 308: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/308.jpg)
Darken
• We want output < input.
0 2550
255
0 2550
255
brighter
darker
![Page 309: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/309.jpg)
Increase contrast
• What do we want?
0 2550
255
0 2550
255
brighter
darker
![Page 310: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/310.jpg)
Increase contrast
• Bright get brighter; dark get darker
0 2550
255
0 2550
255
brighter
darker
128
![Page 311: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/311.jpg)
Decrease contrast?
• What should this look like?
0 2550
255
0 2550
255
brighter
darker
128
![Page 312: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/312.jpg)
Decrease contrast
• “Robin Hood”
0 2550
255
0 2550
255
brighter
darker
128
![Page 313: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/313.jpg)
Filters on Steroids
Brighten OK
Brighten too much
Darken OK
Darken too much
![Page 314: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/314.jpg)
Filters on Steroids (cont’d)
+ Contrast OK
Too much contrast
- Contrast OK
Too little contrast
![Page 315: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/315.jpg)
Enhancements
• How to tell if image needs enhancing? Histogram can help.
• Image processing– Detecting edges and blobs– Applications: maze; counting stars
• Photoshop– inspect, make simple changes to image
![Page 316: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/316.jpg)
Histogram
• Shows distribution of pixel values
• 2 operations based on histogram:– “histogram stretching”: increase contrast
– “thresholding”: Use low points in distribution to serve as cut-offs to reduce the dynamic range. E.g. Dynamic range of 4 (0-3) would require 3 thresholds.
![Page 317: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/317.jpg)
![Page 318: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/318.jpg)
This one may need help
![Page 319: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/319.jpg)
Image processing
• Once image represented as array of numbers, can perform operations such as– Edge detection (how big is a cookie)– Estimating size of irregular shapes.
![Page 320: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/320.jpg)
Example blob
1 1 0 0 0 0 0 1
0 1 1 0 1 1 0 1
0 0 0 0 1 0 0 1
0 0 1 1 1 1 0 0
0 0 1 1 1 1 0 0
0 0 1 1 1 1 0 0
0 0 0 0 1 1 1 0
1 1 0 0 0 0 0 0
How would you find it, and figure out its size?
![Page 321: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/321.jpg)
Photoshop
• Inspect image: Info/navigator palette
• Select portion: Marquee & lasso tool
• Specific things you can do:– Making adjustments (brighten, contrast, etc.)– Copy or move parts of the image, such as
cookie crumbs, or tree branches– Paint with brush; select color with eyedropper
![Page 322: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/322.jpg)
CS 16 – Dec. 2
Communication (Ch. 15)
• Basic communication model
• Cryptography
• Error detection
• Local Area Networks
![Page 323: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/323.jpg)
The model
• Claude Shannon, 1940s
• Broadcast = 1 to many
• Networking = 1 to 1
Six elements:• Source• Destination• Transmitter• Receiver• Channel/medium• _____________
For more on Shannon’s vast contributions, please watch http://www.uctv.tv/search-details.asp?showID=6090
![Page 324: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/324.jpg)
Two directions
• Transmit: – Encode your message in binary (e.g. ASCII)– Encrypt if desired
• Receive:– Decrypt if necessary– Decode from binary to ordinary text
![Page 325: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/325.jpg)
Cryptography
• Big research area
• Terminology:– Plaintext– Ciphertext– Encrypt & decrypt functions
![Page 326: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/326.jpg)
Encryption examples
• Caesar cipher
• Cryptogram
• One-time Pad & Japanese Naval Codes– Dictionary table– Additive table– Destroy each page as you use it
![Page 327: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/327.jpg)
Breaking codes
• Like solving a cryptogram
• Distribution of letters (‘e’ versus ‘q’)
• Digraphs, trigraphs
• Common words
• Eric Nave’s “Betrayal at Pearl Harbor”
![Page 328: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/328.jpg)
Errors in transmission
• Random flipping of bits
• Prepare by using parity bit– Add 9th bit to each byte– Goal is that each byte has even # of 1’s– Receiver checks each byte
– Doesn’t solve every error!
![Page 329: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/329.jpg)
CS 16 – Dec. 4
Communication, continued
• Local Area Networks
• Internet applications
• TCP/IP
![Page 330: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/330.jpg)
Local Area Networks
• Sharing resources in a lab– File server– Printer
• Communication based on topology– point-to-point – star – bus (like speaking at dinner table)– ring (need token to send message)
![Page 331: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/331.jpg)
Bus topology
• All machines share the same channel
• All continuously listening
• “Ethernet” protocol (dinner table)– don’t talk when someone else is talking– collisions
• Amplify signal with repeaters
![Page 332: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/332.jpg)
Token ring
• Fast messaging over larger distances
• Logically arranged in loop
• Messaging: Token passed around the ring.– Am I busy?– From– To– message
![Page 333: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/333.jpg)
Token action
• When you receive token:
• Is the message for me?– If so, read and change to ack.– If not, just pass token.
• Do I need token?– Wait until it comes back as not “busy”
![Page 334: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/334.jpg)
Example
• 4 machines: A, B, C, D.
• A has message for C.– When A gets token, writes message for C.– B passes token.– C receives msg, sends ack message to A.– D passes token.– A receives ack, clears token. …
![Page 335: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/335.jpg)
Example #2
• We have 4 machines A, B, C, D.• What happens when…
– Token starts at D.– A has a message for C.– C has a message for A.– B has a message for D.
…………………………………………
![Page 336: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/336.jpg)
Internet applications
• FTP (file transfer)
• Chat / talk
• Gopher
• WWW
• High-performance computing
Each application: “port” on machine
![Page 337: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/337.jpg)
TCP
Transfer Control Protocol
• Break up message into packets
• Sequence number on each packet
• Receiver detects lost packets
• How big should a packet be?
![Page 338: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/338.jpg)
IP
Internet Protocol • Every machine has IP address
– 156.143.128.20
• Packets are individually addressed• Routers• Not all packets go the same way!
– Just like 2 people driving to Seattle might not take the exact path.
![Page 339: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/339.jpg)
CS 16 – Dec. 9
• Communication– Transmitting messages √
– LANs √
– TCP/IP
– Download speed
• Review
![Page 340: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/340.jpg)
TCP/IP
• TCP = break message into packets, and number them
• IP = each machine has unique address; forward packets toward destination– Ex. 156.143.128.20– Routers are special machines that act like
intersections & guideposts in the network.– Not all packets go the same way! Just like 2
people don’t take exactly the same roads.
![Page 341: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/341.jpg)
Snooping
• Web site can track you by IP address– Localized marketing– Privacy concerns
• Anonymous IP servers– Ex. “Anonymouse”
![Page 342: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/342.jpg)
Behind the scenes
• “ping” program– Send empty packets, check for ack– 75 ms to San Diego… 840 ms to Pretoria
• “traceroute” program– Lists all routers between here and another
machine
![Page 343: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/343.jpg)
Measuring speed
• Overhead = prepare & assemble message
• Flight time = first bit to arrive at destination
• Bandwidth = max rate to propagate data
(cruising speed)
• Total time =
overhead + flight time + (msg size)/bandwidth
![Page 344: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/344.jpg)
Who will win?
File Size Progress “time left” rate
#1 815 KB 65.1% 3:08 1.5 KB/s
#2 5.9 MB 64.8% 24:03 1.5 KB/s
![Page 345: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/345.jpg)
Course outline
• Binary representations– Numbers– Text– Images– Linear vs. nonlinear information
• Excel– Formulas, functions– Tools: Solver, Goal seek, sorting, pivot tables …
• Computer organization– Logic gates & Finite automata– Instruction execution & pipelining
![Page 346: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/346.jpg)
continued
• Memory system• Access
– Queries, relationships, etc.
• Problem solving– Recipes
– Program structure
– Javascript
• Hypertext, Web, Dreamweaver
![Page 347: CS 16 – Aug. 28 Definition of computer & CS Making good decisions Computer organization A little history](https://reader038.vdocument.in/reader038/viewer/2022110100/56649e035503460f94aee58e/html5/thumbnails/347.jpg)
continued
• Operating systems– Responsibilities
– Process scheduling
• Image processing– Filter functions
– Photoshop
• Communication