You are on page 1of 21

By: Mohit Arora

Lecturer , LIECA
LPU
Goals
By the end of this lecture you should …
Understand the role of a computer as a tool in
Computer Science.
Understand the study of algorithms.
Be able to identify how algorithms are developed &
evaluated.
Flowcharts
The Computer as a Tool
Much like the microscope does not define biology or
the test tube does not define chemistry, the computer
doesn't define Computer Science.
The computer is a tool by which Computer Scientists
accomplish their goals – to solve problems.
What is Computer Science?
NOT about coding or hardware or software!
Computer Science is about PROBLEM SOLVING
Computer Science is about DEVELOPING
ALGORITHMS to solve complex problems
What is an Algorithm?
An algorithm is a well-developed, organized approach
to solving a complex problem.
It refers to the logic of the program .
It is step by step solution to given problem.
Now a Create Algorithm!!
Problem: Dad said you to buy books from a shop 10km
from your house.
Step 1: GET THE NAME OF BOOK
STEP2: GET MONEY FROM DAD
STEP 3: GET THE ADDRESS OF THE SHOP
STEP4: TAKE BUS TO SHOP
STEP 5: SEARCH FOR THE BOOK IN SHOP
STEP 6: BUY THE BOOK FROM SHOPKEEPER
STEP 7: COME BACK TO HOME
Algorithm Characteristics
Precise and unambiguous
Each instruction should be executed in finite time.
Should not repeat loop for infinite.
Correct output.
Developing an Algorithm
1. Identify inputs to the system.
2. Identify output of the system.
3. Identify the process.
4. Break the solution to steps.
1. Identify the Inputs
What data do I need?
How will I get the data?
In what format will the data be?
2. Identify the Outputs
What outputs do I need to return to the user?
What format should the outputs take?
3. Identify the Processes
How can I manipulate data to produce meaningful
results?
Data vs. Information
4. Break the Solution to steps.
By breaking the solution to the steps we can easily
understand the logic of program
Create a program to get name and
roll number from user and print it!
Step 1: Initialize name as character and roll number as
integer
Step2: Display message “ENTER NAME:” on screen
Step 3: GET NAME FROM USER
STEP 4: Display message “ENTER R.NO:”
Step 5: GET Roll number from USER
STEP 6: CLEAR THE SCREEN
STEP 7: PRINT NAME on SCREEN
STEP 8: PRINT ROLL NUMBER on SCREEN
STEP 9: STOP
NOW WHAT IS FLOW CHART??
Flow Chart
Flow Chart is pictorial representation of an algorithm.
Whatever we have done in algorithm we can represent
it in picture.
It is easy to understand.
Shows the flow of the instruction
FLOW CHART SYMBOLS
Name Symbol Use in Flowchart

Oval Denotes the beginning or end of the program

Parallelogram Denotes an input operation /output operations

Rectangle Denotes a process to be carried out


e.g. addition, subtraction, division etc.

Diamond Denotes a decision (or branch) to be made.


The program should continue along one of
two routes. (e.g. IF/THEN/ELSE)

Hybrid Denotes an output operation

Flow line Denotes the direction of logic flow in the program


Example:1
Example 2: ADD 2 INTEGERS
START

INPUT VALUE OF A
and B

SUM=A+B

PRINT :SUM

STOP
Any questions?
Thank You

You might also like