0% found this document useful (0 votes)
12 views27 pages

Chapter 01 - Computing and Computers

The document provides an introduction to computer science, covering the meaning of computing, problem definition, solution development, and implementation using computer programs. It explains the concept of algorithms, their properties, and the role of programming languages, particularly Python, in expressing algorithms. Additionally, it discusses the architecture of computers, including memory, control units, and input/output operations, along with various applications of computers.

Uploaded by

Shivkesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views27 pages

Chapter 01 - Computing and Computers

The document provides an introduction to computer science, covering the meaning of computing, problem definition, solution development, and implementation using computer programs. It explains the concept of algorithms, their properties, and the role of programming languages, particularly Python, in expressing algorithms. Additionally, it discusses the architecture of computers, including memory, control units, and input/output operations, along with various applications of computers.

Uploaded by

Shivkesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

COL100

Introduction to Computer Science


Chapter 1 – Computing and Computers

Aadi & Viresh Semester II


CSE@IITD 2024-2025
Agenda
• What is the meaning of computing?

• How do we systematically define a problem and develop a solution?

• How do we implement the solution using a computer program?

• How does a computer execute the solution?

Disclaimer: The contents of these slides are taken from various publicly available resources such as books, talks
and lectures. They are being used for the purpose of classroom teaching and academic dissemination only. The
sources are acknowledged wherever possible.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 2


Pervasiveness of Computing

COL100: Introduction to Computer Science (Semester II, 2024-2025) 3


Can You Compute?
• Multiply two numbers: 9854, 7

9854
7
XXXXX

COL100: Introduction to Computer Science (Semester II, 2024-2025) 4


Long Multiplication Method
• Multiply 4 by 7, obtain 28, write down the unit digit 8, carry 2

• Multiply 5 by 7, obtain 35, add the carry 2, obtain 37, write down 7, carry 3

• Multiply 8 by 7, obtain 56, add the carry 3, obtain 59, write down 9, carry 5

• Multiply 9 by 7, obtain 63, add the carry 5, obtain 68, write down 8, carry 6

• Write down the carry 6

COL100: Introduction to Computer Science (Semester II, 2024-2025) 5


Ingredients of Your Computing Tool
• Set of primitive operations
• Add two 1-digit numbers
• Multiply two 1-digit numbers

• Problem specification
• Input
• 4-digit number
• 1-digit number
• Output
• Product of the given 4-digit number and the 1-digit number

• Solution methodology
• Ordered set of steps to solve the problem using the primitive operations

COL100: Introduction to Computer Science (Semester II, 2024-2025) 6


A More Complex Problem
• Multiple two numbers: 9854, 67

9854
67
0XXXXX
XXXXX0
XXXXXX
COL100: Introduction to Computer Science (Semester II, 2024-2025) 7
Multiplication Method
• Multiply 9854 by 7, write down the result

• Multiply 9854 by 6, shift the result by one decimal place, and write down the result

• Sum the result obtained in Step 1 and the shifted result obtained in Step 2

COL100: Introduction to Computer Science (Semester II, 2024-2025) 8


Compound Operations
• The conceptualized solution to the original problem may include non-primitive operations.

• The original problem can be divided into sub-problems which must be solved first.

• The solution to the sub-problems can be obtained using primitive operations and
packaged as a “compound” operation.

• The solution to the original problem can be obtained by combining the compound
operations.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 9


Computational Model for a Computing Tool
• Primitive operations
• specify the simplest calculations that can made

• Combination methods
• specify how the primitive operations can be combined with one another to obtain a
compound operation

• Abstraction methods
• specify how compound operations can be utilized as individual units

COL100: Introduction to Computer Science (Semester II, 2024-2025) 10


Informal Definition of Algorithm
• To solve a problem using a computing tool, a combination of primitive operations must be
evolved in a certain order.

• An explicit statement of this combination along with the order is an algorithm.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 11


Formal Definition of Algorithm
• An algorithm is a precise and finite specification of the solution to a given problem in a
computational model.

• The solution specification must satisfy the following requirements.

• It must include a definite input and output.

• It must utilize the primitive operations of the computing tool and provide a solution in a
finite number of operations.

• It must be unambiguous.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 12


Core Properties of Algorithm
• Correctness
• Completeness: Given any input, does the algorithm output “a” solution?

• Soundness: Given any input, does the algorithm output the “correct” solution?

• Efficiency
• Is the algorithm fast/slow (time) or does it take more/less memory (space) in relation
to other possibilities?

• Example
• (5 * 4) * (2 + 3 + 5) = 20 * 10 = 200

• (5 * 4) * (2 + 3 + 5) = (5 * 4 * 2) + (5 * 4 * 3) + (5 * 4 * 5) = 40 + 60 + 100 = 200

COL100: Introduction to Computer Science (Semester II, 2024-2025) 13


Why Algorithm?
• Carrying out an algorithm requires no ingenuity / insight / intelligence.

• It can be done by anyone/anything that can perform primitive operations.

• It can be done by a computing tool which has no intelligence or understanding.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 14


Computing and Computers
• Computing is much more fundamental.

• Computing may be done without a computer.

• A computer cannot do much besides computing.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 15


Computer as a Computing Tool
• For solving a problem on a computer:

• We need to use our intelligence to design an algorithm.

• We need to express the algorithm into a form that may be understood by a computer.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 16


Program and Programming Language
• Program: An algorithm expressed in a programming language

• Programming Languages: C, C++, Java, Python

• Like English, every programming language has its well-defined vocabulary (primitives)
and its well-defined grammar (syntax).

• Unlike English, a program written in a programming language has only one meaning.
• Example: “Flying planes can be dangerous”

• What would happen if the program’s meaning is not what the programmer intended?

COL100: Introduction to Computer Science (Semester II, 2024-2025) 17


Why Python?
• Even though most programming languages use essentially the same computing
primitives, each programming language needs to be learned for its specific syntax.

• Programming languages differ in terms of the convenience and facilities they offer even
though they are all equally “powerful” in terms of what they can actually compute.

• Algorithms depend on the computation model, but not on the programming language and
many programming languages have same / similar computational models.

• Python is easy to learn and easy to use to express complex algorithms.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 18


Your First Program
• A simple program to display the message print("Hello, World!")
“Hello, World!” to the terminal.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 19


Computer: Von-Neumann Architecture

Memory

Arithmetic
Control Unit Logic Unit Input
Accumulator

Output
Processor

COL100: Introduction to Computer Science (Semester II, 2024-2025) 20


Memory Unit
• Memory is a collection of cells, each with Address Contents
a unique physical address.
00000000 11100011
• The size of a cell is normally a power of
2, typically a byte (8 bits).
00000001 11001101

• The cells contain data and operation ⋮ ⋮


instructions.
11111101 10001011
• The contents of a cell can be read or
written when given an address. 11111110 00011001
11111111 10011100

COL100: Introduction to Computer Science (Semester II, 2024-2025) 21


Program Structure
• Each program has statements print("Hello, World 1!")
(instructions) for various tasks. print("Hello, World 2!")
print("Hello, World 3!")
• Statements are executed one by one.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 22


Start
Control Unit
• All a computer does is to repeat the
fetch, decode and execute instructions
• forever, Fetch
• until you pull the plug, or instruction
• the system crashes.

Execute Decode
Halt instruction instruction

COL100: Introduction to Computer Science (Semester II, 2024-2025) 23


Arithmetic Logic Unit
• It performs primitive mathematical operations and stores the computed results in the
accumulator.
• Addition
• Subtraction
• Increment Memory
• Decrement

Arithmetic
Control Unit Logic Unit Input
Accumulator

Output
Processor
COL100: Introduction to Computer Science (Semester II, 2024-2025) 24
Input/Output (I/O) Units
• They handle communication with the outside world.

COL100: Introduction to Computer Science (Semester II, 2024-2025) 25


Computer Applications
• Editors
• MS Word
• Spreadsheet
• MS Excel
• Internet Browsers
• Google Chrome
• Media Player
• VLC
• Messaging
• MS Teams

COL100: Introduction to Computer Science (Semester II, 2024-2025) 26


What is Computer Science?
• Learning to use computers/laptops

• Learning to write computer programs

• Computer science is the study of algorithms including their:

• formal and mathematical properties

• linguistic realizations

• hardware realizations

• applications

COL100: Introduction to Computer Science (Semester II, 2024-2025) 27

You might also like