Professional Documents
Culture Documents
01 Lecture Week 1-1
01 Lecture Week 1-1
Computational Intelligence
COMP1002 & COMP8802
Lecture 1
An Introduction to Computer
Science & Algorithms
Denis Kalkofen
4. Their applications
Organization of the Textbook into a six-layer hierarchy
4. Their applications
Organization of the Textbook
4. Their applications
Organization of the Text
5 March 27 Languages / Compiler / Python Level 3 & 4 10 May 15 Networking / Security Level 3
6 April 03 Python continued 11 May 22 Graphics / Human-Machine Level 5
Interaction
• Lecture slides
• Lecture recording
• Contact information
• Contact times
• Announcements
• Assignments
• …
Lecture 1: Organization & Introduction
Week Week Beginning Material Book
1 February 27 An Introduction to Computer Science – Algorithms & History Level 1
Mid-Sem Break
Mid-Sem Break
• For example:
Step 1: Do something
Step 2: Do something
Step 3: Do something
Operations used to construct algorithms
• Sequential operations
– Carries out a single well-defined task
– Usually expressed as simple declarative sentences
– Examples
▪ Add 1 cup of butter
▪ Set the value of x to 1
▪ Subtract 100 from current account balance
Operations used to construct algorithms
• Sequential operations
– Carries out a single well-defined task
• Conditional operations
– Ask a question and the next operation is then selected on the basis of the
answer to that question
– Examples
▪ If the amount of check is less than or equal to the current account balance, then
cash the check; otherwise, tell there are insufficient funds.
▪ If x is not equal to 0, then set z equal to 1/x.
Operations used to construct algorithms
• Sequential operations
– Carries out a single well-defined task
• Conditional operations
– Ask a question and the next operation is then selected on the basis of the
answer to that question
• Iterative operations
– Looping instructions that tell not to go on but go back and repeat the
execution of a previous block of instructions
– Examples:
▪ While there are still more checks to be processed, do the following five steps.
▪ Repeat steps 1, 2, and 3 until the value of y is equal to +1.
Example: Algorithm for adding two m-digit numbers
Result: 072
An example of an algorithm
- Adding two m-digit numbers -
• Sequential operations
– Carries out a single well-
defined task
An example of an algorithm
- Adding two m-digit numbers -
• Conditional operations
– Ask a question and the
next operation is then
selected on the basis of
the answer to that
question
An example of an algorithm
- Adding two m-digit numbers -
• Iterative operations
– Looping instructions that
tell not to go on but go
back and repeat the
execution of a previous
block of instructions
Another Example - Programming a DVR -
An example of an algorithm
- Programming a DVR -
• Conditional operations
– Ask a question and the
next operation is then
selected on the basis of
the answer to that
question
An example of an algorithm
- Programming a DVR -
• Conditional operations
– Ask a question and the
next operation is then
selected on the basis of
the answer to that
question
An example of an algorithm
- Programming a DVR -
• Iterative operations
– Looping instructions that
tell not to go on but go
back and repeat the
execution of a previous
block of instructions
An example of an algorithm
- Programming a DVR -
• Iterative operations
– Looping instructions that
tell not to go on but go
back and repeat the
execution of a previous
block of instructions
An example of an algorithm
- Programming a DVR -
• Sequential operations
– Carries out a single well-
defined task
An example of an algorithm
- Programming a DVR -
• Sequential operations
– Carries out a single well-
defined task
Computer Science and Algorithms
• A well-ordered collection of
• unambiguous and
• effectively computable operations
• that, when executed, produces a result and halts in a finite amount of time
Another Algorithm to the shampooing problem
• Which is better?
More general
Fewer steps
Less memory
Summary
• Computer science is the study of algorithms.
Summary
• Computer science is the study of algorithms.
Source: INTERFOTO/Alamy
Source: INTERFOTO/Alamy
The Early Period: Up to 1940 - 17th Century Devices
• 19th-century devices:
– Joseph Jacquard designed an automated loom that used punched cards to
create patterns (1801)
▪ programmable => considered the first computing device
The Early Period: Up to 1940 - 19th Century Devices
• 19th-century devices:
– Joseph Jacquard designed an automated loom that used punched cards to
create patterns (1801)
• 19th-century devices:
– Herman Hollerith (1880s onward)
▪ Designed and built programmable card-processing machines to read, tally, and
sort data on punched cards for the U.S. Census Bureau 1890
▪ Punch code on a card was used to store personal data
▪ Machine was used to generate statistics
State Gender Disease
▪ Reduced evaluation of census data Chickenpox
from 10 years to 2 years
Rubella
The Early Period: Up to 1940 - 19th Century Devices
• 19th-century devices:
– Mechanical (not electrical)
– Had many features of modern computers:
▪ Representation of numbers and other data
▪ Operations to manipulate the data
▪ Memory to store values in a machine-readable form
▪ Programmable: sequences of instructions could be predesigned for complex
operations
The Birth of Computers: 1940–1950
▪ Improved speed
o 0.3 seconds per additions
o 6 seconds per multiplication
o 15 seconds per division
The Birth of Computers: 1940–1950