Programmingforproblemsolvingunit1ppt 1pdf
Programmingforproblemsolvingunit1ppt 1pdf
Programming language
Algorithms
NextGen Academy
December 7, 2023
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 1 / 45
Introduction to Computers
Programming language
Algorithms
Contents
1 Introduction to Computers
Component of a Computer Architecture
Architecture
Definition of software and hardware
Definition of software and Hardware
2 Programming language
Programming Language
Types of Programming Langauges
Assemblers
3 Algorithms
Characteristics of Algorithms
Complexity of Algorithm
Flow Charts
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 2 / 45
Introduction to Computers
Programming language
Algorithms
Agenda
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 3 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Contents
1 Introduction to Computers
Component of a Computer Architecture
Architecture
Definition of software and hardware
Definition of software and Hardware
2 Programming language
Programming Language
Types of Programming Langauges
Assemblers
3 Algorithms
Characteristics of Algorithms
Complexity of Algorithm
Flow Charts
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 4 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
What is a Computer?
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 5 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 6 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Components of a Computer
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 7 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
1. Input Unit
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 8 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 9 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 10 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
3. Output Unit
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 11 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Characteristics of a Computer
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 12 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
1.2 Architecture
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 13 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 14 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 15 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 16 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
1.2 Architecture
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 17 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 18 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 19 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 20 / 45
Introduction to Computers
Programming language Component of a Computer Architecture
Algorithms
Basic Definitions
Software
Software refers to a set of instructions that tell a computer how to perform specific
tasks. It encompasses both system software, responsible for managing computer
hardware, and application software, designed for end-users to accomplish various
tasks.
System Software: This type of software includes operating systems like
Windows, macOS, and Linux. It manages computer resources and provides a
foundation for other software applications to run.
Application Software: These are programs designed to perform specific tasks
for users. Examples include word processors (Microsoft Word), web browsers
(Google Chrome), and graphic design software (Adobe Photoshop).
Hardware
Hardware represents the physical components of a computer system. It includes
devices such as the central processing unit (CPU), memory (RAM), storage (hard
drives, SSDs), input devices (keyboard, mouse, webcam), and output devices
(monitor, printer, speakers).
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 21 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
Contents
1 Introduction to Computers
Component of a Computer Architecture
Architecture
Definition of software and hardware
Definition of software and Hardware
2 Programming language
Programming Language
Types of Programming Langauges
Assemblers
3 Algorithms
Characteristics of Algorithms
Complexity of Algorithm
Flow Charts
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 22 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 23 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
1 Low-level Language:
Machine Language: Binary instructions directly executed by the computer.
Assembly Language: Uses symbolic representations for machine instructions.
2 High-level Language:
Closer to human language, easier to read and write.
Examples: C, Java, Python, etc.
3 Medium Level Language:
Combines features of both low-level and high-level languages.
Examples: C, C++, Java.
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 24 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 25 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 26 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
1 Low-level Language:
Provides no abstraction from hardware, represented by machine instructions in 0
and 1 forms.
Machine Language:
Consists of binary instructions (0 and 1).
Difficult for programmers to write and comprehend.
Prone to errors, challenging to maintain.
Not portable between different processor architectures.
Assembly Language:
Human-readable commands (e.g., move, add).
Easier to write and understand than machine language.
Requires a translator (assembler) to convert to machine code.
Not fully portable due to processor-specific instructions.
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 27 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
2 High-Level Language:
Allows creation of machine-independent programs.
Resembles human languages, requires a compiler for translation.
Examples: COBOL, FORTRAN, PASCAL, C, C++, JAVA, .NET.
Advantages:
Readable, writable, and maintainable.
Overcomes drawbacks of low-level languages.
Machine-independent and portable.
3 Medium Level Language:
Features of both low-level and high-level languages.
Also known as intermediate-level programming languages.
Examples: C, C++, JAVA.
Combines the efficiency of low-level languages with readability of high-level
languages.
Portable, but may involve some hardware-specific features.
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 28 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
Assembler
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 29 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
Compiler
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 30 / 45
Introduction to Computers
Types of Programming Langauges
Programming language
Assemblers
Algorithms
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 31 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Contents
1 Introduction to Computers
Component of a Computer Architecture
Architecture
Definition of software and hardware
Definition of software and Hardware
2 Programming language
Programming Language
Types of Programming Langauges
Assemblers
3 Algorithms
Characteristics of Algorithms
Complexity of Algorithm
Flow Charts
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 32 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
What is an Algorithm?
Definition
An algorithm is a finite set of instructions carried out in a specific order to perform a
particular task. It is a step-by-step process representing simple logic to solve
problems, often described informally through flowcharts or pseudocode.
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 33 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 34 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Algorithm Steps:
1 Start
2 Declare three integers x, y, and z
3 Define values of x and y
4 Multiply values of x and y
5 Store result to z
6 Print z
7 Stop
Algorithm:
1 Start mul
2 Get values of x and y
3 z ← x×y
4 Display z
5 Stop
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 35 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Algorithm Design
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 36 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Characteristics of Algorithm
1 Efficiency
2 Correctness
3 Clarity
4 Scalability
5 Reliability
6 Optimality
7 Robustness
8 Adaptability
9 Simplicity
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 37 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Complexity of an Algorithm
Time Complexity
The amount of time required to complete an algorithm’s execution is called time
complexity. The big O notation is used to represent an algorithm’s time complexity.
Space Complexity
The amount of space an algorithm requires to solve a problem and produce an
output is called its space complexity. Space complexity is expressed in big O
notation.
Note
After understanding what an algorithm is, its analysis and approaches, we will look
at different types of algorithms.
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 39 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Flowcharts
Definition
A flowchart is a visual representation of a process, showing the steps involved and
their order. It uses different shapes to represent different types of steps and arrows
to indicate the flow of the process.
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 41 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Creating a Flowchart
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 42 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Benefits of Flowcharts
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 43 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 44 / 45
Introduction to Computers Characteristics of Algorithms
Programming language Complexity of Algorithm
Algorithms Flow Charts
Dr. Vishwa Pratap Singh Unit 1: Introduction to Computer, Programming & Algorithms 45 / 45