Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
18 views

Intro To Algorithm and Programming 01

The document provides an overview of Dr. Reza Kalan's background and qualifications, including his areas of research interest. It then outlines the topics to be covered in an introduction to algorithms course, including programming concepts like loops, arrays, pointers and functions. The document also describes the assessments for the course, which will include quizzes, assignments and a final exam.

Uploaded by

okatarinatmo11
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Intro To Algorithm and Programming 01

The document provides an overview of Dr. Reza Kalan's background and qualifications, including his areas of research interest. It then outlines the topics to be covered in an introduction to algorithms course, including programming concepts like loops, arrays, pointers and functions. The document also describes the assessments for the course, which will include quizzes, assignments and a final exam.

Uploaded by

okatarinatmo11
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Dr.

Reza Kalan
•Ph.D. In Information Technology
•M.S. In Computer Engineering
•B.S. In Computer Engineering
•Area of Research Interest : Computer Networks, Mobile Communication, Multimedia System
•Google Scholar : https://scholar.google.com.tr/citations?user=YbD9foUAAAAJ&hl=en

DR. REZA KALAN 1


Outline
We W i l l C o v e r T h e s e S k i l l s :
 Introduct ion/overview of algorithm
 Introduction to programming
 C /C++ programming language
 If & switch case
 Loops (For & While)
 Array & strings
 Pointers
 Functions

COME102 DR. REZA KALAN

Introduction to Algorithm USKUDAR UNIVERSITY- 2024


Assessments
 Attendance:
 Attendance is mandatory, for more information please visit university site

 Basis for Evaluation:


 Participation -----
 Assignments -----
 Quizzes 40%
 Final 60%

DR. REZA KALAN 3


Lecture 01
We will cover these skills:
 Introduction
 Pictorial language
 Flowchart
 Algorithm
 Algorithm Properties

REZA KALAN 4
Algorithm & Programming / Introduction
Bit & Byte Definition:
• One bit has two different patterns: “0” or “1”

• One Byte= 8 bits

• One byte=28 different combination


• (Start with 0, go up, 0, 1, 2, 3, 4, 5, ... 254, 255)
• Really good for storing characters/letters.

•-----------------------------------------------
•1 Kilo byte (1 KB)= 210 bits= 1024 bits
•1 Mega byte (1MB) = 220 bits= 1024 K bits
•1 Giga byte (1GB) = 230 bits=
1024*1024*1024 bits

DR. KALAN 5
Algorithm & Programming / Introduction
Computer Block Diagram:

•A computer’s CPU (Central processing Unit) controls the manipulation of data.

•CPU is responsible for fetching instructions and data from memory and executing them
• It receives instructions and data from input devices which it stores in main memory
• Later, it fetch these instruction and data from main memory and executes them to produce results

•CPU, I/O and Memory communication.


•I/O : Input/ Output

DR.KALAN 6
Algorithm & Programming / Introduction
CPU Communications:
•The CPU consists of the arithmetic logic unit (ALU) and the control unit.
• The control unit coordinates the computer’s activities

• The ALU performs operations on data

•The CPU contains cells or registers for temporary storage of information.


•Registers are conceptually like main memory cells
•General-purpose registers serve as temporary holding places for data being manipulated by the CPU.
• They hold inputs to the ALU and store results from the ALU.

•Data in main memory (RAM) are moved to these registers to be operated on by the CPU:
• Control Unit moves the data,

• ALU operates on them

DR. KALAN 7
Algorithm & Programming / Introduction
Data Storage in Main Memory:

•A bit is one of the digit 0 or 1

•Data and programs are represented as a string of binary digits

•Computers represent information (program, & data) as patterns of binary digits(bits)

•Therefore, to represent a bit, the hardware needs a capability to being in one of state (0/1 or on/off)

•A memory cell is mage up of 1 to 4 bytes ( e.g., 8 bits to 32 bits), depending on word length of system (computer)

•For example: 3+2= 5

• 0011 +0010 = 0101

DR. KALAN 8
Algorithm & programming / Introduction
Data Storage in Main Memory:

•Each cell memory can be read or written (modified) individually

•RAM is volatile because information stored is lost on power off

•Thus, secondary memories are used too store data for future use (e.g., Disk, CD/DVD )

•At the user and program level, physical storage addresses are commonly referenced using logical name or addresses like
variable name of file name.

DR. KALAN 9
Algorithm & programming / Introduction
Software Systems:

•The software system drive the physical hardware components through a sequence of instructions called programs.

•There are many software systems in computer :

•Operating systems: for managing computer resources such as Window, Linux, Unix, Apple OS

•Compilers: for translating high level programming languages to machine language (bits). For example C/ C++ Pascal

•Network Software: for allowing more than one computer communicate together and share information (e.g., SSH,FTP)

•Application or Productively Tools: to perform daily business and office operations (e.g., word, spread sheet, database)

DR.KALAN 10
Algorithm & programming / Introduction
Overview of Algorithm:

•An algorithm is a set of well-defined instructions in finite sequence to solve a problem.

•As an effective method, an algorithm can be expressed within a finite amount of time and space, and in a well-defined
formal language for calculating a function.

•Starting from an initial state and initial input (perhaps empty), the instructions describe a computation that, when executed,
proceeds through a finite number of well-defined successive states, eventually producing "output“, and terminating at a
final ending state.

DR. KALAN 11
Algorithm & programming / Introduction
Algorithm & Programming Languages:
Programmers routinely use hundreds of coding languages for a wide variety of applications. Web and software developers
use popular programming languages like JavaScript, C#, and Python as full-stack development tools.
 Programming (Coding) languages enable computers to understand human-generated instructions for various commands
and computations.
Computer languages are machine language, assembly language, and high level languages.

Low-level Coding Languages: Low-level programming languages contain basic instructions for a computer to understand.
 Examples are assembly and machine code.

High-level Coding Languages: High-level coding languages are the furthest away from the actual code that translates
commands on a computer system.
 Examples include C++, Java, and Python.

•Note: Assembly language is a symbolic representation of machine language, consisting of binary code executed directly by the computer's
hardware. Machine language is a collection of bits (or binary digits) to be read and interpreted by a computer.

DR. KALAN 12
Algorithm & programming / Introduction
Types of Programming Languages:
Current programming languages fall into one of the following four programming paradigms
Imperative or Procedural: Procedural programming is a type of imperative programming in which the program is built from
one or more procedures (also termed subroutines or functions).
 Example: Pascal, Fortran, C

Functional: Functional programming focuses on functions and their inputs and outputs. functional programming aims to
write code that is clearer to understand and more bug resistant.
 Example: Erlang, Haskell, Scala, Lisp

Logical: Logic programming is a programming, database and knowledge representation paradigm based on formal logic.
 Example:Prolog, SQL

Object-Oriented: OOP focuses on objects, which are instances of a class, and their interactions with each other.
 Example: Java, C++, C#, andPython

DR. KALAN 13
Algorithm & programming / Introduction
Front-end and back-end development:

Front-End Web Development Coding Languages


Front-end development is the "client side" of web development, responsible for the user-interactive parts of a website.
 Example : HTML, JavaScript

Back-End Web Development Coding Languages


•Users never come in contact with back-end operations;
• Example: languages like Java, Python, and Ruby are critical in ensuring all functions and activities run seamlessly.

DR. KALAN 14
Algorithm & programming / Introduction
Compiler vs Interpreter:
To perform an instruction written in high-level language via computer, we need to convert it into machine language. To do
this, either a compiler or an interpreter, or both are used.
Compiler:
 A compiler translates code from a high-level programming language (e.g., C / C++, java) into machine code before the program runs.
 A compiler takes entire program in one go. Then, it is faster and efficient

Interpreter:
 An interpreter translates code written in a high-level programming language (e.g., PHP)into machine code line-by-line as the code runs.
 A interpreter takes a single line of code at a time. Then slower and inefficient

DR. KALAN 15
Algorithm & programming / Introduction
Algorithm and Programming Language:
Before a program written in high level language is executed by the CPU, it needs to be translated, linked and loaded into
memory in a process called compilation and linking.
Preprocessing: In this section our source code is attached to the preprocessor file. Different types of
header files are used like the (#include <studio.h>, #include <math.h>, etc). C source code is attached to
these types of files and the final C Source generates.

Compiler: The preprocessed source code moves to the compiler, and an assembly-level code is generated
by the compiler after the compilation of the whole C source code program. All the different files which
have the C program must be saved with the .c extension. For the compiler to understand whether the
program file is a C program file or not.

Assembler: This part usually generates the Object code. This object code is quite similar to the machine
code or the set of binary digits. After this assembler part, The Linker continues the process, producing an
executable.exe file at the end.

Linker: The compiler has no idea about the working of the function (printf, scanf, etc). The information for
each of these functions is kept in the corresponding library (#include)., The basic goal of the linker is to
link the object file to the library functions so that the program may be run as an executable file (.exe).

Loader: With the help of the loader, the .exe file is loaded in the RAM and the CPU is informed of the
starting point of the address of the program where it is loaded.

DR. KALAN 16

You might also like