Introduction To Computing Lecture 00: Part 3 Introduction To Algorithms and Flowcharts (Continued)
Introduction To Computing Lecture 00: Part 3 Introduction To Algorithms and Flowcharts (Continued)
• 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
Input radius
Set pi = 3.14
Calculate area = pi * radius * radius
Labwork 2
• 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
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