0% found this document useful (0 votes)
8 views26 pages

Lect 0

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

Lect 0

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

COM115

Introduction to Computer Science

Ankara University
Department of Computer Engineering
Introduction

• Computer science, seeks to build scientific


foundation for topics as
– Computer design
– Computer programming
– Information processing
– Algorithmic solutions of problems
– Algorithmic process itself.
Study of Algorithms

• (informal) algorithm is a set of steps that defines how


a task is performed.
• Machine-compatible representation of an algorithm is
called a program.
• Etymology: Al-Khwarizmi (Persian astronomer,
mathematician), On Calculation with Hindu Numerals.
(http://en.wikipedia.org/wiki/Algorithm)
• Long division, Euclidian for GCD, etc.
Euclidian algorithm

• One of the oldest algorithms known.


• Determines the greatest common divisor (GCD) of two
elements (e.g. integers) without factoring the elements.
– Input: A, B (two integers, B A)
– Output: the GCD of A and B
– 1. divide A by B, and call the remainder R
– 2. If R is not 0, then A = B, B = R and repeat 1
else return B as the GCD
Study of Algorithms

• Once an algorithm for a task is found,


performing that task no longer requires
understanding, only following directions.

• In a sense, intelligence required for the task


is encoded in the algorithm.
Study of Algorithms

• Algorithms capturing and conveying


intelligence allows us to build machines that
display intelligent behaviour.
• Level of intelligence is limited by what can be
conveyed through algorithms.
• I.e. If no algorithm exists for a task, then a
machine cannot perform that task.
A Simple Algorithm

First (known) Algorithm by


Al-Khowarismi circa AD830
Solution to 1st and 2nd Degree equations
AX2 + BX = C
• Divide B by 2 =D
• Multiply D by D = E
• Add E to C =F
• Find square root of F = G
• Subtract B/2 from G : this is the result
A Simple Algorithm (2)
Example: X2 + 10X = 39

• Divide 10 by 2 =5
• Multiply 5 by 5 = 25
• Add to 39 = 64
• Find square root of 64 = 8
• Subtract 5 from 8 : 3 - this is the result
See Article by K.Kılan, in TBD Bilişim No 80.
www.tbd.org.tr
Implementing Algorithms
• Algorithms can be carried out by people ...
(verbal/written instructions)
• Or by machines (alarm clock) ...
(mechanical instructions)
• Or by computers ...
(electrical instructions)
• Or by biological organisms
(neurons, amino acids, hormones...)
Data / Information

• Data is the raw representation of some


physical quantity.

• Information is structured and interpreted data

• In computer science, algorithms use data and


produce data for some end-user
Computer Algorithms
To be able to use computers,
• Algorithms and data must be coded in terms
of electrical pulses (eventually).

• We will need to represent numbers and text


data (letters,...) as electrical pulses.

• Results represented by the electrical pulses


(inside computer) must be decoded into
forms suitable for humans.
Computer Programs
Algorithm in coded form is a computer
program, or program’s code.

Translation from concepts to computer internal


form is done in several phases, and each
involves coding with a different style:
• From concepts to a high level language
• From high level language to low level language,
• From low level language to machine language,
• From machine language to internal (voltage) form
Data Representation

Data must be represented depending on its


type and usage:
Numerical data must be represented according
to a number system
Text data must be represented according to a
standard coding table.
A Simplified Computer

Logical View
• CPU (Central Processing Unit)
• Memory (RAM, ROM, Cache)
• Input Devices (keyboard, mouse, ...)
• Output Devices (Screen, printer, ...)
• Mass Storage Devices (disks, tapes)
Computer Block Diagram
CPU

ALU
Input Output
Unit Unit
Control Register
Unit Unit

Data and Address Busses

Memory
Terminology
Algorithm Algoritma
Representation Gösterim
Coding Kodlama
Data (p.), Datum (s.) Veri
Information Bilgi
Programming language Programlama dili
High-level language Yüksek (üst) düzey dil
Low-level language Alt düzey dil
Terminology

RAM (Random Access Memory) Rastgele erisimli bellek


ROM (Read Only Memory) Salt-okunur bellek
Data Bus Veri (iletim) yolu
Address Bus Adres (iletim) yolu
Memory Bellek
ALU (Arithmetic Logic Unit) Aritmetik mantık birimi
Control Unit Denetim birimi
Input Giris / Girdi
Output Çıkıs / Çıktı
Device Aygıt
Origins of Computing Machines

• Early data storage: punched cards


– First used in Jacquard Loom (1801) to store patterns
for weaving cloth
– Stored programs in Babbage’s Analytical Engine
– Popular through the 1970’s
• Early data storage: punched paper tape
– Popular through the 1970’s
Early computers

• Based on mechanical relays


– 1940: Stibitz at Bell Laboratories
– 1944: Mark I: Howard Aiken and IBM at Harvard
• 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.
Computer Science

• The science of algorithms


• Draws from other subjects, including
– Mathematics
– Engineering
– Psychology
– Business Administration
Central Questions of Computer
Science

• Which problems can be solved by algorithmic


processes?
• How can discovery of algorithms be made easier?
• How can techniques of representing and
communicating algorithms be improved?
• How can our knowledge of algorithms and technology
be applied to provide better machines?
• How can characteristics of different algorithms be
analyzed and compared?
Figure 0.5 The central role of
algorithms in computer science
Abstraction: Definitions

• Abstraction = the distinction between the


external properties of an entity and the details
of the entity’s internal composition.
• Abstract tool = a component of a larger system
whose internal composition we ignore.
Uses of abstraction

• Abstraction allows us to use things we don’t


fully understand.
• We all can use electrical devices, etc. that we
either do not understand or cannot produce.
• Computer scientists can use algorithms
implemented by others without understanding
their details.
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
Outline of our study (continued)

• Chapter 6: Programming languages


• Chapter 7: Software engineering
• Data organization
– Chapter 8: Data abstractions
– Chapter 9: Database systems
• Chapter 10: Artificial intelligence
[Chapter 11: Theory of computation ]

You might also like