0% found this document useful (0 votes)
63 views

Introduction To Computing Lecture 00: Part 3 Introduction To Algorithms and Flowcharts (Continued)

This document discusses algorithms and flowcharts. It introduces algorithms expressed through natural language, pseudocode, and flowcharts. Examples of each are provided, such as a recipe expressed as a natural language algorithm and a game board algorithm expressed in pseudocode. Flowchart symbols are explained and flowchart examples show algorithms to calculate interest and find the sum of the first 50 numbers. Students are given labwork assignments to draw flowcharts for algorithms such as finding the largest of three numbers or dividing two numbers using subtraction.
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)
63 views

Introduction To Computing Lecture 00: Part 3 Introduction To Algorithms and Flowcharts (Continued)

This document discusses algorithms and flowcharts. It introduces algorithms expressed through natural language, pseudocode, and flowcharts. Examples of each are provided, such as a recipe expressed as a natural language algorithm and a game board algorithm expressed in pseudocode. Flowchart symbols are explained and flowchart examples show algorithms to calculate interest and find the sum of the first 50 numbers. Students are given labwork assignments to draw flowcharts for algorithms such as finding the largest of three numbers or dividing two numbers using subtraction.
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/ 25

Introduction to Computing

Lecture 00: Part 3


Introduction to Algorithms and
Flowcharts (continued)

Assist.Prof.Dr. Nükhet ÖZBEK


Ege University
Department of Electrical&Electronics
Engineering
[email protected]
Expressing Algorithms

• Natural Languages
• Pseudocode
• Flowcharts
• Programming Languages
Natural Language Algorithm
Cilbir
• 6 eggs
• ½ kg yogurt
• 3 large garlic cloves
• 4 Tbs fresh butter
• 1 tsp red pepper, coarsely ground
• 2 middle-sized onions cut horizontally
• plenty water
• Boil water in a fairly big pot. Break one by one the eggs and pour them in a
plate, being careful not to break the yolk. To ensure a homogenous
cooking, let them “glide” from the plate into the boiling water. Within three
minutes the eggs are ready but if you prefer hard-boiled, allow them to
cook for another minute or so.
• Meanwhile brown the butter in a skillet and add the garlic and onion. In the
last possible moment add the coarsely ground red pepper and turn off the
fire. Remove the eggs from the pot using a skimmer and place them in a
deep plate.
• Cover the eggs with plenty of yogurt and pour the hot butter over them.
Serve immediately.
From www.gourmet.gr
Pseudocode Algorithm Example
Set moveCount to 1
FOR each row on the board
FOR each column on the board
IF gameBoard position (row, column) is occupied THEN
CALL findAdjacentTiles with row, column
INCREMENT moveCount
END IF
END FOR
END FOR
Algorithm Example
Set number counter to zero
Set sum to zero
While (number counter < 10)
{
input a number
Sum = Sum + Number
increment number counter by 1
}
Calculate average = sum / 10
Labwork 1

• Write an algorithm to calculate the area of


circle
Labwork 1

Input radius
Set pi = 3.14
Calculate area = pi * radius * radius
Labwork 2

• Write an algorithm to calculate the sum of


multiples of 3 up to 100
Labwork 2

Set number counter to zero


Set sum to zero
While (number counter < 100)
{
Sum = Sum + Number counter
increment number counter by 3
}
Flowcharts
• Flowcharts are schematic representations of
processes
• Generally the start point, end points, inputs,
outputs, possible paths and the decisions that
lead to these possible paths are included
• Flow-charts can be created by hand or manually
in most office software, but lately specialized
diagram drawing software has emerged that can
also be used for the purpose
Flowchart Symbols (Mostly Used)

• Start / End symbol


• Arrows

• Processing steps
• Input/Output

• Conditional (Decision)
Flowchart Symbols (Others)
• Document

• Magnetic Tape

• Display

• Manual Input
Flowchart Example

From wikipedia.org
Flowchart Example

From smartdraw.com
Flowchart Example

Read NAME, BALANCE, RATE


Compute INTEREST as BALANCE x RATE
Write (Display) NAME and INTEREST
Flowchart Example

From wikipedia.org
Flowchart Example
START

Input N
Sum =0
C=0
Input number
Sum = Sum + number
C=C+1

No C = N?
Yes
A = Sum / N

Print A

END
Labwork 3

• Draw a flowchart to find the sum of first


50 counting numbers
Labwork 3
Labwork 4

• Draw a flowchart to find the largest of


three numbers A,B, and C.
Labwork 5

• Draw a flowchart to find the product of


two numbers using only addition operation
Labwork 5
Labwork 6

• Draw a flowchart to find the division of


two integer numbers using only
subtraction operation. Find the division
and remainder.
Labwork 6
Summary

• Problem Solving Process


• Algorithms
• Components of Algorithms
• Flowcharts

You might also like