際際滷

際際滷Share a Scribd company logo
Algorithm and Flowcharts
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
Algorithm and Flowcharts
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
/output operations
Example:1
Example 2: ADD 2 INTEGERS
START
INPUT VALUE OF A
and B
SUM=A+B
PRINT :SUM
STOP
Any questions?
Thank You

More Related Content

Algorithm and Flowcharts

  • 2. 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
  • 3. 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.
  • 4. 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
  • 6. 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.
  • 7. 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
  • 8. Algorithm Characteristics Precise and unambiguous Each instruction should be executed in finite time. Should not repeat loop for infinite. Correct output.
  • 9. 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.
  • 10. 1. Identify the Inputs What data do I need? How will I get the data? In what format will the data be?
  • 11. 2. Identify the Outputs What outputs do I need to return to the user? What format should the outputs take?
  • 12. 3. Identify the Processes How can I manipulate data to produce meaningful results? Data vs. Information
  • 13. 4. Break the Solution to steps. By breaking the solution to the steps we can easily understand the logic of program
  • 14. 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
  • 15. NOW WHAT IS FLOW CHART??
  • 16. 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
  • 19. Example 2: ADD 2 INTEGERS START INPUT VALUE OF A and B SUM=A+B PRINT :SUM STOP