Upload
truonghanh
View
234
Download
0
Embed Size (px)
Citation preview
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Computer Science: An Overview
Tenth Edition
by
J. Glenn Brookshear
Chapter 0:
Introduction
Presentation files modified by Farn Wang
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-2
Chapter 0: Introduction
• 0.1 The Role of Algorithms
• 0.2 The Origins of Computing Machines
• 0.3 The Science of Algorithms
• 0.4 Abstraction
• 0.5 An Outline of Our Study
• 0.6 Social Repercussions
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-3
Terminology
• Algorithm: A set of steps that defines how
a task is performed
• Program: A representation of an algorithm
• Programming: The process of developing
a program
• Software: Programs and algorithms
• Hardware: Equipment
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-4
• Select a deck of 10 black and a deck of 10
red cards.
• Put them face down.
• Shuffle the cards in the two decks.
• Pick a red card if the audience want red.
• Pick a black card otherwise.
A magic trick
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-5
• Select a deck of 10 black and a deck of 10
red cards.
• Put them face down.
• Bend the red deck slightly concave.
• Bend the black deck slightly convex.
• Shuffle the cards in the two decks.
• Pick a concave card if the audience want
red.
• Pick a convex card otherwise.
An algorithm for a magic trick
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-6
History of Algorithms
• The study of algorithms was originally a
subject in mathematics.
• Early examples of algorithms
– Long division algorithm
– Euclidean Algorithm
• Gödel's Incompleteness Theorem: Some
problems cannot be solved by algorithms.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-7
The Euclidean algorithm
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-8
Origins of Computing Machines
• Early computing devices
– Abacus: positions of beads represent numbers
• Only a storage device
• needs operation by human
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-9
Origins of Computing Machines
• Early computing devices
– Gear-based machines (1600s-1800s)
• Positions of gears represent numbers
• Blaise Pascal (for additions)
• Wilhelm Leibniz (for the selection of a few operations)
• Charles Babbage
– differential engine (a prototype),
– analytical engine (truly programmable, never built)
– program, programmer
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-10
Origins of Computing Machines
• Early computing devices
– Augusta Ada King, Countess of Lovelace
– 10 December 1815 – 27 November 1852
– The daughter of poet Lord Byron
– Programmer of Babbage’s Analytical
Engine
– Author of a paper describing how to write
programs for various operations.
– The first known programmer in the history.
– US Ministry of Defense defined a
language called Ada.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-11
Early Data Storage
• Punched cards
– First used in Jacquard Loom (1801) to store
patterns for weaving cloth
– Storage of programs in Babbage’s Analytical
Engine
– Hollerith’s machine for US 1890 census
• IBM
– Popular through the 1970’s
• Gear positions
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-12
Early Computers
• Based on mechanical relays
– 1940: Stibitz at AT&T Bell Laboratories
– 1944: Mark I: Howard Aiken and IBM at Harvard
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-13
Early Computers
• Based on vacuum tubes
– 1937-1941: Atanasoff-Berry at Iowa State
– 1940s: Colossus: secret German code-breaker
– 1940s: ENIAC: Mauchly & Eckert at U. of Penn.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 14
The War in North Africa, WWII
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Pacific war
- from a computational perspective
Japan radio communication was
deciphered by US with electronic
computing technology.
• Battle of the coral sea (May 4–8, 1942)
• Battle of Midway (June 4-7, 1942)
• 聯合艦隊司令 山本五十六 擊落(April 18,
1943)
• Bougainville Island
15
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Battle of Midway
- from a computational perspective
Deciphered information
• A Japanese decoy fleet to Dutch Harbor, Alaska,
June 3, 1942
• Target: AF Midway
• Time of the battle
– in-time repair of carrier Yorktown
• The composition of the Japanese fleet
– Throughout the battle, Japanese did not know how many US
carriers there were.
16
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 17
Battle of Midway, June 4, 1942
加賀號(Kaga)
赤城號(Akagi)
蒼龍號(Soryu)
飛龍號(Horyu)
Enterprise
Hornet
Yorktown
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 18
Battle of Midway, June 4, 1942
蒼龍號
閃避轟炸中
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 19
Battle of Midway, June 4, 1942 加賀號(Kaga)
赤城號(Akagi)
蒼龍號(Soryu)
飛龍號(Horyu)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 20
Battle of Midway, June 4, 1942
飛龍號燃燒中
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
The 1st Modern Computer
ENIAC
• arguable
• general-purpose functional computer
• In University of Pennsylvania
• Only hardware and programs
• The computers ? Men or machines ?
21
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Downsizing of modern computers
• Transistors
– William Shockley, John Bardeen, Walter
Brattain (AT&T Bell Lab.)
• IC, Integrated Circuits
– Jack Kilby, Robert Noyce
0-22
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Downsizing of modern computers
• Moore’s law
– half cost in 18
months
– double density,
speed in 18
months
0-23
Gordon Moore
co-founder of Intel
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-24
Personal Computers
• First used by hobbyists
– Apple computer
– motherboard + keyboard + monitor
• IBM introduced the PC in 1981.
– Accepted by business
– Became the standard hardware design for
most desktop computers
– Most PCs use software from Microsoft
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Confluence of
computing & communication
Computing
• PDA
• notepad
• GPS
• sensors
• smartphone
0-25
Communication
• Internet
• emails,
• browsers
• search engines
• social groups
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Computing & Communications
on the history
茉莉花革命
0-26
佔領華爾街
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Computing & Communications
on the history
0-27
• Profit from hardware 1960-1980
• Profit from software 1980-2000
• Profit from data 2000-2010
• Profit from traffic & services 2010-?
Google, Youtube, Facebook, ….
Now the big brother is coming back to haunt
us.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-28
Computer Science
• The science of algorithms
• Draws from other subjects, including
– Mathematics
– Engineering
– Philosophy
– Business Administration
– Psychology
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-29
Central Questions of Computer
Science
• Which problems can be solved by algorithmic processes?
• How can algorithm discovery be made easier?
• How can techniques of representing and communicating algorithms be improved?
• How can characteristics of different algorithms be analyzed and compared?
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-30
Central Questions of Computer
Science (continued)
• How can algorithms be used to manipulate information?
• How can algorithms be applied to produce intelligent behavior?
• How does the application of algorithms affect society?
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-31
The central role of algorithms in
computer science
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Algorithms – application of
• Common algorithms for various
applications
– sorting, searching, string matching, query
processing, logic analysis, graph algorithms,
genetic programming, neural networks, …
• Techniques to adapt existing algorithms
• Efficiency enhancement
0-32
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Algorithms – analysis of
• Computation time ?
– average-case
– worst-case
– probabilistic analysis
• Space requirement ?
• How many messages ?
• Complexities with respect to input sizes
0-33
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Algorithms – discovery of
• Can a problem be solved with existing
algorithms ?
– One algorithm ?
– A combination of algorithms ?
• New algorithms needed ?
• Information/knowledge representation ?
– data structure ?
• Do the algorithms meet the goal ?
– specification, verification, testing ? 0-34
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Algorithms – representation of
• Meeting the various styles of reasoning.
– flowcharts
– natural languages
– case analysis
– scenarios
– rule sets
• Supporting strutural reasoning
• Revealing logic errors
0-35
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Algorithms – communication of
• Conveying of unambiguous ideas
• Enhancing comprehensibility
• Automation of
– specification reviewing
– algorithm analysis
– collaborative authoring and development
– testing
– verification
0-36
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Algorithms – execution of
How does a computer execute your program ?
• Programming language design
– the basic computation primitives
– the pseudo machines
• Compilation
– optimization of instruction orders
– multithread – workload
decomposition/distribution
• Linking/loading
• Scheduling
0-37
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Algorithms – limitations of
• Computability
– What problems can be solved with algorithms ?
• Intractability
– What cost do we pay for the algorithms ?
– space complexities
– time complexities
– message complexities
• Near optimal approximations
0-38
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-39
Abstraction
• Abstraction:
– The distinction between the external
properties of an entity and the details of the
entity’s internal composition
• Abstract tool:
– A “component” that can be used without
concern for the component’s internal
properties
– OO: C++, Java,
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-40
Outline of Our Study
• Chapter 1: Data Storage
• Chapter 2: Data Manipulation
• Chapter 3: Operating Systems
• Chapter 4: Networks and the Internet
• Chapter 5: Algorithms
• Chapter 6: Programming Languages
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-41
Outline of Our Study (continued)
• Chapter 7: Software Engineering
• Chapter 8: Data Abstractions
• Chapter 9: Database Systems
• Chapter 10: Computer Graphics
• Chapter 11: Artificial Intelligence
• Chapter 12: Theory of Computation
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
• Principles of right and wrong
• Assumes individuals are acting as free
moral agents to make choices to guide
their behavior
Ethics
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-43
Ethical Theories
• Consequence based (utilitarianism):
What leads to the greatest benefit?
• Duty based:
What are my intrinsic obligations?
• Contract based:
What contracts must I honor?
• Character based (Plato & Aristotle):
Who do I want to be?
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-44
• Redistribution of decision-making rights,
power, and other resources.
Example: IT makes it possible for millions of
people to download video files, weakening
the exclusive rights of movie studios to
control distribution for their own profit.
• Creation of new opportunities to commit
crimes.
Example: E-mail creates the conditions for
extensive “phishing” or online con games
designed to defraud ordinary citizens.
Why ethical issues in computer
science ?
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-45
Social Repercussions
• Advances in computer science raise new
questions.
– In law: Questions of rights and liabilities
– In government: Questions of regulation
– In the work place: Questions of
professionalism
– In society: Questions of social behavior
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Social Repurcussions
- Google example
• Google search: compliance to individual
government’s policy ?
• YouTube: liability for file distribution of
users?
• Google Books: copyright ?
• Google Maps: collection of peoples’
whereabout ?
0-46
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-47
• Using systems to increase efficiency, and causing layoffs and personal hardships
• jobless recovery ?
• Using systems to monitor employee e-mail to protect valuable assets, but decreasing employee privacy
• Monitoring employee use of the Internet at work, decreasing employee privacy
• Using huge databases to aggregate consumer information, reducing the costs of granting credit, but increasing the chance of losing personal data to criminals, terrorists, or others
Dilemmas (王士元)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-48
• Privacy: Claim of individuals to be left alone,
free from surveillance or interference from
other individuals, organizations, or the state.
The claim to be able to control information
about yourself
• Fair information practices
Privacy & freedom (I/III)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-49
• Privacy
• Fair information practices: Set of principles
governing the collection and use of
information on the basis of U.S. and
European privacy laws
http://www.ftc.gov/reports/privacy3/fairinfo.shtm
Federal Trade Commission
Privacy & freedom (II/III)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-51
http://www.ftc.gov/reports/privacy3/fairinfo.shtm
Federal Trade Commission
Over the past quarter century, government agencies in the
United States, Canada, and Europe have studied the
manner in which entities collect and use personal
information -- their "information practices" -- and the
safeguards required to assure those practices are fair and
provide adequate privacy protection.
The result has been a series of reports, guidelines, and model
codes that represent widely-accepted principles
concerning fair information practices.
Fair information practices (I/II)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-52
http://www.ftc.gov/reports/privacy3/fairinfo.shtm
Federal Trade Commission
Common to all of these documents are five core principles
of privacy protection:
(1) Notice/Awareness;
(2) Choice/Consent;
(3) Access/Participation;
(4) Integrity/Security; and
(5) Enforcement/Redress.
Fair information practices (II/II)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 0-53
• DPMA and ACM Codes of Conduct
http://www.acm.org/constitution/code.html • Geographic Information System Professionals
Code of Ethics • General federal privacy laws:
Freedom of Information Act, 1966 Privacy Act of 1974
Electronic Communications Privacy Act of 1986 Computer Matching and Privacy Protection Act of
1988 Computer Security Act of 1987 Federal Managers Financial Integrity Act of 1982
Ethics codes & privacy laws