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

Computer 4 - Introduction To Computer Programming - Module 1 - Lesson 1

The document outlines the program outcomes and course objectives of an introductory computer programming course in Python. The program outcomes focus on applying knowledge of computing fundamentals and developing solutions with creativity. The course aims to teach fundamental programming concepts like data types, arrays, conditionals and functions using Python. By the end of the course, students will be able to choose appropriate programming constructs and coding standards to solve computing problems.

Uploaded by

sdf
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Computer 4 - Introduction To Computer Programming - Module 1 - Lesson 1

The document outlines the program outcomes and course objectives of an introductory computer programming course in Python. The program outcomes focus on applying knowledge of computing fundamentals and developing solutions with creativity. The course aims to teach fundamental programming concepts like data types, arrays, conditionals and functions using Python. By the end of the course, students will be able to choose appropriate programming constructs and coding standards to solve computing problems.

Uploaded by

sdf
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

 

PROGRAM‌‌OUTCOMES:‌  ‌

In‌‌pursuance‌‌of‌‌the‌‌above-stated‌‌mission,‌‌the‌‌objectives‌‌of‌‌the‌‌College‌‌are‌‌as‌‌follows:‌  ‌

1. Apply‌‌knowledge‌‌of‌‌computing,‌‌theories,‌‌fundamentals,‌‌models,‌‌mathematics‌‌and‌‌science‌‌
 
appropriate‌‌to‌‌the‌‌discipline;‌  ‌
2. Analyze‌‌a‌‌problem,‌‌identify‌‌and‌‌define‌‌the‌‌need‌‌and‌‌user‌‌requirements‌‌appropriate‌‌to‌‌its‌‌ 
solution;‌  ‌
3. Design,‌‌implement‌‌and‌‌evaluate‌‌a‌‌computer-based‌‌system,‌‌process,‌‌component‌‌or‌‌program‌‌
 
to‌‌meet‌‌desired‌‌needs;‌  ‌
4. Develop‌‌ideas‌‌and‌‌solutions‌‌with‌‌creativity‌‌and‌‌innovation‌‌with‌‌appropriate‌‌considerations‌‌
 
to‌‌ethics,‌‌cultural,‌‌and‌‌environment‌‌factors;‌  ‌
5. Analyze‌‌the‌‌local‌‌and‌‌global‌‌impact‌‌of‌‌technology‌‌on‌‌individuals,‌‌organizations‌‌and‌‌society;‌  ‌
6. Function‌‌effectively‌‌as‌‌a‌‌member‌‌or‌‌leader‌‌of‌‌a‌‌development‌‌team‌‌recognizing‌‌the‌‌different‌‌ 
roles‌‌within‌‌a‌‌team‌‌to‌‌accomplish‌‌a‌‌common‌‌goal;‌  ‌
7. Assist‌‌in‌‌the‌‌creation‌‌of‌‌an‌‌effective‌‌project‌‌plan;‌  ‌
8. Recognize‌‌the‌‌legal,‌‌social,‌‌ethical‌‌and‌‌professional‌‌issues‌‌involved‌‌in‌‌the‌‌utilization‌‌of‌‌
 
computer‌‌technology‌‌and‌‌be‌‌guided‌‌by‌‌the‌‌adoption‌‌of‌‌appropriate‌‌professional,‌‌ethical‌‌and‌‌
 
legal‌‌practices;‌  ‌
9. Recognize‌‌the‌‌fast-paced‌‌demands‌‌of‌‌industry‌‌allowing‌‌him‌‌or‌‌her‌‌to‌‌formulate‌‌personal‌‌ 
goals‌‌aligned‌‌to‌‌organizational‌‌goals‌‌in‌‌order‌‌to‌‌determine‌‌plans‌‌of‌‌action‌‌to‌‌improve‌‌own‌‌
 
performance,‌‌capability‌‌and‌‌self.‌‌Such‌‌goals‌‌allow‌‌the‌‌student‌‌to‌‌self-assess‌‌him/himself‌‌to‌‌ 
determine‌‌his‌‌development‌‌needs;‌  ‌
10. Ability‌‌to‌‌effectively‌‌communicate‌‌and‌‌present‌‌the‌‌designed‌‌solutions‌‌with‌‌a‌‌range‌‌of‌‌
 
audiences‌‌both‌‌in‌‌oral‌‌and‌‌in‌‌writing;‌  ‌
11. Apply‌‌current‌‌and‌‌appropriate‌‌techniques,‌‌skills‌‌and‌‌tools‌‌necessary‌‌for‌‌the‌‌IT‌‌profession‌  ‌

 ‌
 ‌
 ‌
 ‌
 ‌
COURSE‌‌TITLE:‌ ‌Introduction‌‌to‌‌Computer‌‌Programming‌‌with‌‌Python‌  ‌
COURSE‌‌DESCRIPTION:‌‌   ‌

This‌  ‌is‌  ‌an‌  ‌introductory‌  ‌course‌  ‌in‌  ‌programming‌  ‌which‌  ‌aims‌  ‌to‌‌
  develop‌‌
  skills‌‌
  and‌‌
  concepts‌‌
 
that‌  ‌are‌  ‌essential‌  ‌to‌  ‌good‌  ‌programming‌  ‌practice‌  ‌and‌  ‌problem-solving‌  ‌using‌‌
  Python‌‌
  Programming‌‌
 
Language.‌‌
  It‌‌
  covers‌‌
  fundamental‌‌
  programming‌‌
  concepts‌‌
  of‌‌
  primitive‌‌
  data‌‌
 types,‌‌ arrays,‌‌ simple‌‌
 I/O,‌‌ 
conditional‌  ‌statements,‌  ‌iterative‌  ‌structures‌  ‌and‌  ‌functions.‌  ‌It‌  ‌also‌  ‌includes‌  ‌the‌  ‌use‌  ‌of‌  ‌testing‌  ‌and‌‌
 
debugging‌  ‌techniques.‌  ‌Fundamental‌  ‌to‌  ‌the‌  ‌software‌  ‌development‌  ‌practice‌‌
  is‌‌
  the‌‌
  ability‌‌
  to‌‌
  develop‌‌
 
programs‌  ‌that‌  ‌uses‌  ‌appropriate‌  ‌constructs‌‌
  aside‌‌
  from‌‌
  achieving‌‌
  desired‌‌
  results‌‌
  to‌‌
  solve‌‌
  computing‌‌ 
problems.‌‌This‌‌course‌‌also‌‌serves‌‌as‌‌a‌‌preparation‌‌for‌‌intermediate‌‌programming.‌  ‌
At‌‌
  the‌‌
  end‌‌
  of‌‌
  the‌‌
  course,‌‌
  the‌‌
  students‌‌
  are‌‌
  expected‌‌
  to‌‌
  be‌‌
  able‌‌
  to‌‌
  make‌‌
  judicious‌‌
  choices‌‌ of‌‌ 
programming‌‌constructs‌‌to‌‌solve‌‌computing‌‌problems‌‌using‌‌appropriate‌‌coding‌‌standards.‌  ‌
 ‌
COURSE‌‌OUTCOMES:‌‌
   ‌

In‌‌this‌‌course,‌‌you‌‌should‌‌be‌‌able‌‌to:‌  ‌

1. analyze‌  ‌and‌  ‌explain‌  ‌the‌  ‌structure‌  ‌and‌  ‌behaviour‌  ‌of‌  ‌Python‌  ‌involving‌  ‌the‌  ‌following‌‌
 
fundamental‌‌programming‌‌constructs:‌‌assignment,‌‌I/O,‌‌selection,‌‌iteration,‌‌arrays;‌  ‌
2. design‌  ‌and‌  ‌implement‌  ‌a ‌ ‌program‌  ‌that‌  ‌uses‌  ‌the‌  ‌fundamental‌  ‌construct‌  ‌of‌  ‌Python‌  ‌to‌  ‌solve‌‌
 
computing‌‌problem;‌  ‌
3. adapt‌‌
  an‌‌ appropriate‌‌
 coding‌‌ standard‌‌
 with‌‌
 proper‌‌
 documentation‌‌
 in‌‌
 order‌‌
 to‌‌
 come‌‌
 up‌‌ with‌‌ a ‌‌
readable,‌‌understandable‌‌and‌‌maintainable‌‌program‌‌code;‌  ‌
4. select‌‌
  and‌‌
  apply‌‌
  appropriate‌‌
  debugging‌‌
  and‌‌
 testing‌‌ techniques‌‌
 to‌‌ ensure‌‌
 the‌‌ correctness‌‌ of‌‌
 a ‌‌
program;‌  ‌
5. propose‌  ‌and‌  ‌develop‌  ‌stand-alone‌  ‌program‌  ‌by‌  ‌implementing‌‌
  them‌‌
  in‌‌
  Python‌‌
  programming‌‌ 
language‌‌to‌‌solve‌‌real-life‌‌problems;‌  ‌
6. evaluate‌‌program‌‌functionality‌‌required‌‌to‌‌decide‌‌whether‌‌it‌‌can‌‌meet‌‌user‌‌requirements‌‌; ‌ ‌
 ‌
 ‌
 ‌
 ‌
 ‌
Module‌‌1‌‌–‌‌Programming‌‌Basics‌‌and‌‌Logic‌  ‌

Introduction:‌  ‌

The‌  ‌aim‌‌
  of‌‌
  this‌‌
  module‌‌
  is‌‌
  to‌‌
  introduce‌‌
  the‌‌
  underlying‌‌
  concepts‌‌
  of‌‌
  programming‌‌
  languages‌‌
 
that‌  ‌will‌  ‌provide‌  ‌the‌  ‌theoretical‌  ‌foundation‌  ‌that‌  ‌they‌  ‌will‌  ‌need‌  ‌in‌  ‌order‌  ‌to‌  ‌create‌  ‌programs.‌‌ 
Programming‌  ‌languages‌  ‌are‌  ‌important‌  ‌for‌  ‌software‌  ‌technologies.‌  ‌In‌  ‌this‌  ‌unit,‌  ‌history‌  ‌and‌‌
 
development‌  ‌of‌  ‌programming‌  ‌languages‌  ‌will‌  ‌be‌  ‌introduced‌  ‌and‌  ‌to‌  ‌further‌  ‌develop‌  ‌students’‌‌
 
problem-solving‌‌skills,‌‌algorithm‌‌and‌‌flowchart‌‌will‌‌be‌‌discussed.‌ 
 ‌
Module‌‌Learning‌‌Outcomes:‌  ‌

In‌‌this‌‌module,‌‌you‌‌should‌‌be‌‌able‌‌to:‌  ‌
1. define‌‌the‌‌different‌‌terminology‌‌used‌‌in‌‌programming;‌  ‌
2. identify‌‌the‌‌evolution‌‌of‌‌programming‌‌languages.‌  ‌
3. explain‌‌how‌‌computer‌‌translate‌‌high‌‌level‌‌languages‌‌using‌‌interpreter‌‌or‌‌compiler.‌  ‌
4. explain‌‌the‌‌Software‌‌Development‌‌Life‌‌Cycle‌‌stages.‌  ‌
5. demonstrate‌  ‌basic‌  ‌problem‌  ‌solving‌  ‌skills:‌  ‌analyzing‌  ‌problems,‌  ‌creating‌  ‌algorithms‌  ‌and‌‌
 
modeling‌‌a‌‌problem‌‌using‌‌flowchart.‌  ‌
 ‌

Lesson‌‌1 ‌ ‌

Algorithm‌‌and‌‌Flowchart‌  ‌

I. Learning‌‌Outcomes:‌‌    ‌
In‌‌this‌‌lesson,‌‌you‌‌should‌‌be‌‌able‌‌to:‌‌   ‌
1. differentiate‌‌the‌‌terms‌‌use‌‌in‌‌program‌‌logic‌‌sequence;‌  ‌
2. decompose‌‌problems‌‌into‌‌a‌‌sequence‌‌of‌‌simple‌‌steps;‌  ‌
3. apply‌‌the‌‌basic‌‌flowchart‌‌symbols‌‌in‌‌flowcharting‌‌real-life‌‌problems;‌  ‌
4. value‌‌the‌‌importance‌‌of‌‌following‌‌instructions‌‌in‌‌solving‌‌problems;‌  ‌
5. create‌‌an‌‌algorithm‌‌and‌‌flowchart‌‌to‌‌solve‌‌problems;‌  ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
II. Pre‌‌–‌‌Assessment‌  ‌

Instruction:‌W
‌ rite‌‌your‌‌answer‌‌in‌‌the‌‌space‌‌provided.‌  ‌
_____1. _______graphically‌‌represents‌‌how‌‌a‌‌problem‌‌solution‌‌can‌‌be‌‌broken‌‌into‌‌
 
subtasks.‌  ‌
A. A‌‌flowchart‌  ‌
B. Pseudocode‌  ‌
C. An‌‌algorithm‌  ‌
D. A‌‌structure‌‌chart‌  ‌
_____2. A(n)‌‌_______‌‌must‌‌list‌‌every‌‌step‌‌in‌‌a‌‌problem‌‌solution‌‌necessary‌‌to‌‌get‌‌the‌‌
 
correct‌‌output‌‌from‌‌the‌‌input.‌‌
   ‌
A. Algorithm‌  ‌
B. problem‌‌definition‌  ‌
C. programming‌‌process‌  ‌
D. input‌‌chart‌  ‌
_____3. Which‌‌of‌‌‌the‌‌three‌‌types‌‌of‌‌program‌‌structures‌‌would‌‌be‌‌the‌‌most‌‌‌useful‌‌if‌‌a‌‌
 
program‌‌needed‌‌to‌‌read‌‌the‌‌names‌‌and‌‌test‌‌scores‌‌of‌‌200‌‌students?‌  ‌
A. the‌‌sequence‌  ‌ C. the‌‌loop‌‌structure‌  ‌
B. the‌‌decision‌‌structure‌  ‌ D. none‌  ‌
_____4. Which‌‌of‌‌the‌‌following‌‌statements‌‌best‌‌describes‌‌the‌‌function‌‌of‌‌this‌‌flowchart?‌  ‌
A. It‌‌calculates‌‌the‌‌time‌‌needed‌‌to‌‌travel‌‌a‌‌specified‌‌distance‌‌at‌‌a‌‌specified‌‌speed.‌  ‌
B. It‌‌calculates‌‌the‌‌distance‌‌that‌‌can‌‌be‌‌traveled‌‌in‌‌a‌‌specified‌‌time‌‌at‌‌a‌‌specified‌‌speed.‌  ‌
C. It‌‌calculates‌‌the‌‌speed‌‌needed‌‌to‌‌travel‌‌a‌‌specified‌‌distance‌‌in‌‌a‌‌specified‌‌time.‌  ‌
D. It‌‌calculates‌‌the‌‌amount‌‌of‌‌gas‌‌used‌‌to‌‌travel‌‌a‌‌specified‌‌distance‌‌in‌‌a‌‌specified‌‌time.‌  ‌
_____5. Pseudo‌‌code‌‌uses‌‌_______‌‌to‌‌express‌‌a‌‌program’s‌‌logic.‌  ‌
A. English-like‌‌statements‌  ‌
B. an‌‌object‌‌program‌  ‌
C. geometric‌‌symbols‌  ‌
D. stepwise‌‌refinement‌ 
_____6. A‌‌_______‌‌is‌‌used‌‌to‌‌perform‌‌repetitive‌‌tasks‌‌that‌‌involve‌‌executing‌‌a‌‌sequence‌‌ 
of‌‌instructions‌‌as‌‌many‌‌times‌‌as‌‌needed.‌  ‌
A. Flowchart‌  ‌
B. Loop‌  ‌
C. decision‌‌structure‌  ‌
D. simple‌‌sequence‌  ‌
E. ‌‘ ‌ ‌
_____7. When‌‌you‌‌write‌‌an‌‌algorithm‌‌the‌‌order‌‌of‌‌the‌‌instructions‌‌is‌‌very‌‌important.‌  ‌
A. True‌  ‌ B. False‌  ‌
_____8. What‌‌should‌‌be‌‌considered‌‌when‌‌designing‌‌an‌‌algorithm?‌  ‌
A. If‌‌the‌‌correct‌‌hardware‌‌is‌‌being‌‌used‌  ‌
B. If‌‌the‌‌correct‌‌software‌‌is‌‌being‌‌used‌  ‌
C. If‌‌there‌‌is‌‌more‌‌than‌‌one‌‌way‌‌of‌‌solving‌‌the‌‌problem‌  ‌
D. All‌‌of‌‌the‌‌above‌  ‌
_____9. When‌‌can‌‌algorithms‌‌be‌‌used?‌  ‌
A. Only‌‌with‌‌computers‌  ‌
B. Only‌‌when‌‌programming‌  ‌
C. Only‌‌with‌‌flowcharts‌  ‌
D. Any‌‌time‌‌to‌‌design solutions‌‌to‌‌problems‌  ‌
_____10. What‌‌is‌‌the‌‌difference‌‌between‌‌a‌‌flowchart‌‌and‌‌pseudocode? ‌  ‌
A. A‌‌flowchart‌‌is‌‌diagrammatic‌‌while‌‌pseudocode‌‌is‌‌written‌‌in‌‌a‌‌programming‌‌language‌‌
 
(eg.‌‌Pascal‌‌or‌‌Python) ‌  ‌
B. A‌‌flowchart‌‌is‌‌textual‌‌but‌‌pseudocode‌‌is‌‌diagrammatic ‌  ‌
C. A‌‌flowchart‌‌is‌‌a‌‌diagrammatic‌‌description‌‌of‌‌an‌‌algorithm‌‌whilst‌‌pseudocode‌‌is‌‌a ‌‌
textual‌‌description‌‌of‌‌an‌‌algorithm ‌  ‌
D. A‌‌flowchart‌‌and‌‌pseudocode‌‌are‌‌the‌‌same‌‌thing ‌  ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
III. Lesson‌‌Map:‌   ‌ ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

IV. Core‌‌Content:‌  ‌

ACTIVATE:‌ ‌Marching‌‌Orders‌  ‌

Activity‌  ‌1:‌‌
  Computers‌‌  work‌‌  by‌‌
  following‌‌   lists‌‌
  of‌‌
  instructions,‌‌
  and‌‌  they‌‌
  do‌‌  exactly‌‌  what‌‌
 
the‌‌instructions‌‌say—even‌‌if‌‌they‌‌don’t‌‌make‌‌sense!‌  
Instruction:‌  ‌Before‌  ‌going‌  ‌over‌  ‌this‌  ‌learning‌  ‌module,‌  ‌you‌  ‌read‌  ‌and‌  ‌do‌  ‌the‌  ‌following‌‌ 
instructions.‌‌   ‌

1. Draw‌‌a‌‌dot‌‌in‌‌the‌‌center‌‌of‌‌box.‌‌
   ‌
2. Starting‌  ‌at‌  ‌the‌  ‌top‌  ‌left-hand‌  ‌corner‌  ‌of‌‌
  the‌‌
  page‌‌
  r ule‌‌
  a ‌‌straight‌‌
  line‌‌
  through‌‌
  the‌‌
  dot‌‌
 
finishing‌‌at‌‌the‌‌bottom‌‌right‌‌hand‌‌corner.‌‌
   ‌
3. Starting‌  ‌at‌  ‌the‌  ‌bottom‌  ‌left-hand‌  ‌corner‌  ‌of‌  ‌the‌  ‌page‌  ‌r ule‌  ‌a ‌ ‌line‌  ‌through‌  ‌the‌  ‌dot,‌‌
 
finishing‌‌at‌‌the‌‌top‌‌right‌‌hand‌‌corner.‌‌
   ‌
4. Write‌‌your‌‌name‌‌in‌‌the‌‌triangle‌‌in‌‌the‌‌center‌‌of‌‌the‌‌left-hand‌‌side‌‌of‌‌the‌‌page.‌  ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌

The‌‌purpose‌‌of‌‌this‌‌activity‌‌is‌‌to‌‌assess‌‌how‌‌well‌‌the‌‌students‌‌in‌‌understanding‌‌and‌‌ 
following‌‌instruction.‌  ‌

   ‌
ACQUIRE:‌  ‌
 ‌
Algorithm‌‌(noun)‌‌–‌‌Al-go-ri-thm‌‌
   ‌
An‌  algorithm‌  ‌is‌  ‌step‌  ‌by‌  ‌step‌  ‌instruction‌  ‌to‌  ‌be‌  ‌carried‌  ‌out‌  ‌in‌  ‌order‌  ‌to‌  ‌solve‌  ‌a ‌ ‌specific‌‌ 
problem‌‌
  or‌‌
  class‌‌
  of‌‌
  problems.‌‌
  An‌‌
  algorithm‌‌
  is‌‌
  a ‌‌‌recipe‌‌
 for‌‌
 ‌solving‌‌
 a ‌‌problem‌. ‌‌Daily‌‌ life‌‌
 abounds‌‌ 
with‌‌algorithms‌‌in‌‌the‌‌form‌‌of‌‌directions‌‌such‌‌as:‌  ‌
● purchasing‌‌something‌‌from‌‌a‌‌general‌‌store‌‌and‌‌making‌‌payments‌  ‌
● ‌depositing‌‌fee‌‌in‌‌school‌  ‌
● ‌withdrawing‌‌money‌‌from‌‌bank‌‌account‌  ‌
All‌  ‌these‌‌
  activities‌‌
  involve‌‌
  some‌‌
  kind‌‌
  of‌‌
  problem‌‌
  solving.‌‌
  Recipes‌‌
  in‌‌
  cookbooks‌‌
  are‌‌
 
frequently‌‌
  cited‌‌
  as‌‌
  examples‌‌
  of‌‌
  algorithms.‌‌
  Even‌‌
  most‌‌
  household‌‌
  products‌‌
  are‌‌
  labeled‌‌
  with‌‌ 
simple‌  ‌"algorithms"‌  ‌for‌  ‌their‌  ‌use.‌  ‌For‌  ‌example,‌  ‌a ‌ ‌bottle‌  ‌of‌  ‌shampoo‌  ‌might‌  ‌contain‌  ‌the‌‌
 
following‌‌
  “algorithm”‌‌
  written‌‌
  at‌‌ the‌‌ back:‌‌
 “Apply‌‌ to‌‌ wet‌‌ hair.‌‌
 Massage‌‌
 gently.‌‌
 Leave‌‌
 on‌‌ for‌‌ a ‌‌
few‌‌moments.‌‌Rinse‌‌Off ”.‌‌
   ‌
Each‌‌
  of‌‌
  these‌‌
  homely‌‌
  illustrations‌‌
  share‌‌
  some‌‌
  features‌‌
  with‌‌
  algorithms‌‌
  in‌‌
 computer‌‌ 
programs.‌  ‌Similarly,‌  ‌all‌  ‌the‌  ‌tasks‌  ‌that‌  ‌can‌  ‌be‌  ‌carried‌  ‌out‌  ‌by‌  ‌a ‌ ‌computer‌  ‌can‌  ‌be‌  ‌stated‌  ‌as‌‌
 
algorithms.‌‌
  Once‌‌
  an‌‌
  algorithm‌‌ has‌‌ been‌‌
 designed,‌‌
 it‌‌ is‌‌
 implemented‌‌
 through‌‌
 a ‌‌programming‌‌ 
language,‌‌and‌‌then‌‌the‌‌program‌‌will‌‌be‌‌executed‌‌by‌‌a‌‌computer.‌‌
   ‌
Most‌  ‌computer‌  ‌programmers‌  ‌spend‌  ‌a ‌ ‌large‌  ‌percentage‌  ‌of‌  ‌their‌  ‌time‌  ‌creating‌‌
 
algorithms.‌‌ The‌‌
 rest‌‌
 of‌‌ their‌‌
 time‌‌
 is‌‌
 spent‌‌
 debugging‌‌
 the‌‌
 algorithms‌‌
 that‌‌
 don’t‌‌ work‌‌
 properly.‌‌
 
The‌‌
  goal‌‌
  is‌‌
  to‌‌
  create‌‌
  efficient‌‌
  algorithms‌‌
  that‌‌
  do‌‌
  not‌‌
 waste‌‌
 more‌‌
 computer‌‌
 resources‌‌
 such‌‌ a ‌‌
s‌‌
  RAM‌‌
  and‌‌
  CPU‌‌ time.‌‌
 This‌‌
 can‌‌
 be‌‌
 difficult,‌‌
 because‌‌ an‌‌
 algorithm‌‌
 that‌‌
 performs‌‌
 well‌‌
 on‌‌ one‌‌
 
set‌‌
  of‌‌
  data‌‌
 may‌‌
 perform‌‌
 poorly‌‌ on‌‌
 other‌‌
 data.‌‌
 As‌‌
 you‌‌
 might‌‌
 guess,‌‌ poorly‌‌
 written‌‌
 algorithms‌‌
 
can‌‌cause‌‌programs‌‌to‌‌r un‌‌slowly‌‌and‌‌even‌‌crash.‌‌   ‌
Therefore,‌  ‌software‌  ‌updates‌  ‌are‌  ‌often‌  ‌introduced,‌  ‌touting‌  ‌“improved‌  ‌stability‌  ‌and‌‌ 
performance”.‌  ‌While‌  ‌this‌  ‌sounds‌  ‌impressive,‌  ‌it‌  ‌also‌  ‌means‌  ‌that‌  ‌the‌  ‌algorithms‌  ‌in‌  ‌the‌‌
 
previous‌‌versions‌‌of‌‌the‌‌software‌‌were‌‌not‌‌written‌‌as‌‌well‌‌as‌‌they‌‌could‌‌have‌‌been.‌‌   ‌
A‌‌well‌‌written‌‌algorithm‌‌has‌‌the‌‌following‌‌characteristics:‌  ‌
✔ Input:‌‌‌An‌‌algorithm‌‌may‌‌or‌‌may‌‌not‌‌require‌‌input‌   ‌ ‌
✔ Output:‌‌‌Each‌‌algorithm‌‌is‌‌expected‌‌to‌‌produce‌‌at‌‌least‌‌one‌‌result‌   ‌ ‌
✔ Definiteness:‌‌ ‌Each‌‌instruction‌‌must‌‌be‌‌clear‌‌and‌‌unambiguous.‌   ‌ ‌
✔ Finiteness:‌  ‌If‌  ‌the‌  ‌instructions‌  ‌of‌  ‌an‌  ‌algorithm‌  ‌are‌  ‌executed,‌  ‌the‌  ‌algorithm‌‌ 
should‌‌terminate‌‌after‌‌finite‌‌number‌‌of‌‌steps‌  ‌
Algorithm‌‌can‌‌be‌‌presented‌‌by:‌  ‌
⮚ Pseudocode:‌  ‌The‌‌
  steps‌‌
  of‌‌
  the‌‌
  algorithm‌‌
  are‌‌
  written‌‌
 in‌‌ English‌‌
 in‌‌
 a ‌‌shorthand‌‌
 
form‌‌which‌‌represents‌‌the‌‌flow‌‌of‌‌control‌‌through‌‌the‌‌algorithm.‌  ‌
⮚ Flowchart:‌‌   ‌
A‌  ‌flowchart‌  ‌is‌  ‌a ‌ ‌graphical‌  ‌representation‌  ‌of‌  ‌the‌  ‌problem-solving‌‌
  process.‌‌
  ‌With‌‌ 
algorithms,‌  ‌we‌  ‌can‌  ‌easily‌  ‌understand‌  ‌a ‌ ‌program.‌  ‌The‌  ‌main‌  ‌purpose‌  ‌of‌  ‌a ‌‌
flowchart‌‌
  is‌‌
  to‌‌
  analyze‌‌
  different‌‌
  processes.‌‌
  Several‌‌
  standard‌‌
  graphics‌‌
  are‌‌
  applied‌‌ 
in‌‌a‌‌flowchart.‌  ‌
Uses‌‌of‌‌a‌‌f lowchart:‌‌   ‌
- To‌‌specify‌‌the‌‌method‌‌of‌‌solving‌‌a‌‌problem‌  ‌
- To‌‌plan‌‌the‌‌sequence‌‌of‌‌a‌‌computer‌‌program‌  ‌
Flowchart‌‌Symbols‌  ‌

Name‌  ‌ Symbol‌  ‌ Use‌ 


 ‌  ‌ Used‌t‌ o‌‌represent‌‌start‌‌and‌‌end‌‌of‌‌
 
Terminal‌‌Block‌  ‌ flowchart‌  ‌
Flow‌‌line‌  ‌  ‌ Flow‌‌line‌‌Used‌‌to‌‌indicate‌‌the‌‌flow‌‌ 
of‌‌logic‌‌by‌‌connecting‌‌symbols‌  ‌
Input/Output‌‌Block‌  ‌   ‌ Used‌f‌ or‌‌input‌‌and‌‌output‌‌ 
 ‌ operation‌  ‌
Process‌‌Block‌  ‌  ‌ Processing:‌‌Used‌‌for‌‌arithmetic‌‌  
 ‌ operations‌‌and‌‌data-manipulations‌  ‌
 ‌
 ‌  ‌ Decision‌‌making.‌‌Used‌‌to‌‌represent‌‌  
Decision‌‌Block‌  ‌  ‌ the‌‌operation‌‌in‌‌which‌‌there‌‌are‌‌ 
 ‌ two/three‌‌alternatives,‌‌true‌‌and‌‌ 
 ‌ false‌‌etc.‌  ‌
 ‌  ‌ Use‌‌to‌‌list/declare‌‌the‌‌input‌‌and‌‌ 
Initialization‌‌Block‌  ‌   ‌ output‌‌in‌‌the‌‌flowchart‌  ‌
 ‌

Page‌‌Connector‌  ‌  ‌ Use‌‌for‌‌continuation‌‌of‌‌the‌‌process‌‌
 
 ‌ flowchart‌‌on‌‌the‌‌same‌‌page‌‌
   ‌
Off‌‌Page‌‌Connector‌  ‌   ‌ Use‌‌for‌‌continuation‌‌of‌‌a‌‌process‌‌ 
 ‌ flowchart‌‌onto‌‌another page‌  ‌

Type‌‌of‌‌Flowchart‌‌Structure‌  ‌

Algorithms‌‌in‌‌general‌‌has‌‌different‌‌structures,‌‌basically‌‌there‌‌are‌‌three‌‌different‌‌structures.‌  ‌

1. Sequential‌‌Structure‌  ‌
2. Conditional‌S‌ tructure‌  ‌
3. Loop‌‌Structure‌‌  

Real‌‌Life‌‌Algorithm‌‌and‌‌Flowchart‌  ‌

Sequential‌‌Structure‌  ‌

Example‌‌1:‌‌Preparing‌‌a‌‌tea‌  ‌

1. Pour‌‌some‌‌of‌‌the‌‌boiled‌‌water‌‌into‌‌the‌‌cup.‌  ‌
2. Put‌‌the‌‌teabag‌‌in‌‌a‌‌cup.‌  ‌
3. Add‌‌sugar‌‌to‌‌the‌‌cup.‌  ‌
4. Stir‌‌the‌‌tea.‌  ‌
5. Drink‌‌the‌‌tea.‌  ‌
 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

‌ onvert‌‌Temperature‌‌from‌‌Fahrenheit‌‌(℉
Example‌‌2:‌C ‌ ‌)‌‌to‌‌Celsius‌‌(℃
‌ )‌  ‌ ‌

Step‌‌1:‌‌Start‌  ‌
Step‌‌2:‌‌Input‌‌temperature‌‌in‌‌Fahrenheit‌‌(F).‌‌   ‌
Step‌‌3:‌‌Calculate‌‌temperature‌‌with‌‌formula‌‌C=5/9*(F-32),‌  ‌
Step‌‌4:‌‌Print‌‌Celsius‌‌(C).‌ 
Step‌‌5:‌‌End‌  ‌
 ‌
 ‌

Conditional‌‌Structure‌  ‌

Example‌‌3:‌P
‌ reparing‌‌a‌‌tea‌‌   ‌

1. Pour‌‌some‌‌of‌‌the‌‌boiled‌‌water‌‌into‌‌the‌‌cup.‌  ‌
2. Put‌‌the‌‌teabag‌‌in‌‌a‌‌cup‌  ‌
3. Add‌‌sugar‌‌to‌‌the‌‌cup‌‌if‌‌desired‌  ‌
4. Stir‌‌the‌‌tea.‌  ‌
5. Drink‌‌the‌‌tea.‌  ‌
 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

Example‌‌4:‌‌‌Finding‌‌the‌‌smallest‌‌number‌  ‌

Step-1:‌‌Start‌‌   ‌
Step-2:‌‌Input‌‌two‌‌numbers‌‌say‌‌NUM1,‌‌NUM2‌‌
   ‌
Step-3:‌‌IF‌‌NUM1‌‌<‌‌NUM2‌‌THEN‌‌print‌‌smallest‌‌is‌‌NUM1‌  ‌
‌ELSE‌‌print‌‌smallest‌‌is‌‌NUM2‌‌ENDIF‌‌
  
Step-4‌‌Stop‌  ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
Loop‌‌Structure‌  ‌
Example‌‌5:‌S‌ hopping‌‌for‌‌Dress‌  ‌
Step‌‌1:‌‌Start‌  ‌
Step‌‌2:‌‌Go‌‌to‌‌a‌‌Mall‌  ‌
Step‌‌3:‌‌walk‌‌around‌‌and‌‌pick‌‌a‌‌dress‌  ‌
Step‌‌4:‌‌Try‌‌On‌‌
   ‌
Step‌‌5:‌‌If‌‌size‌‌is‌‌OK,‌‌buy‌‌it‌  ‌
Else‌‌take‌‌another‌‌piece‌  ‌
Step‌‌6:‌‌Stop‌  ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌

 ‌
 ‌

V. Topic‌‌Summary:‌  ‌
● An‌‌algorithm‌‌is‌‌a‌‌set‌‌of‌‌instructions‌‌that‌‌is‌‌used‌‌to‌‌perform‌‌a‌‌certain‌‌task.‌  ‌
● An‌  ‌algorithm‌  ‌is‌  ‌simply‌  ‌a ‌ ‌set‌  ‌of‌  ‌steps‌  ‌to‌  ‌follow‌  ‌to‌  ‌obtain‌  ‌a ‌ ‌desired‌  ‌result.‌  ‌To‌  ‌have‌  ‌good‌‌ 
algorithm,‌‌the‌‌steps‌‌should‌‌be‌‌simple,‌‌logical,‌‌and‌‌clearly-defined.‌  ‌
● Algorithm‌‌can‌‌be‌‌represented‌‌using‌‌pseudo‌‌code‌‌or‌‌flowchart.‌  ‌
●  It's‌  ‌simply‌  ‌an‌  ‌implementation‌‌
  of‌‌
  an‌‌
  algorithm‌‌
  in‌‌
  the‌‌
  form‌‌
  of‌‌
  annotations‌‌
  and‌‌
  informative‌‌
 
text‌‌written‌‌in‌‌plain‌‌English‌  ‌
● Flowchart‌‌uses‌‌the‌‌help‌‌of‌‌symbols‌,‌‌shapes‌‌and‌‌arrows‌‌to‌‌make‌‌the‌‌process‌‌more‌‌logical.‌  ‌
● Flowchart‌‌has‌‌three‌‌structure‌‌namely‌‌Sequential,‌‌Conditional‌‌and‌‌Looping.‌  ‌
 ‌
VI. References:‌  ‌
 ‌
Books:‌  ‌
● Malik,D.‌  ‌(2012).‌  ‌Java‌  ‌Programming‌‌
  from‌‌
  Problem‌‌
  Analysis‌‌
  to‌‌
  Program‌‌
  Design,‌‌
 
5‌th‌‌ ‌Edition.‌ ‌Cengage‌‌Learning‌‌Asia‌‌Pte‌‌Ltd.‌‌Place‌‌of‌‌Publication.‌‌Pasig‌‌City.)‌  ‌
● Pomperada,J‌  ‌(2018).‌  ‌Introduction‌  ‌to‌  ‌Java‌  ‌Programming‌  ‌Revised‌  ‌Edition.‌  ‌
Mindshapers‌‌Co.,‌‌Inc.‌‌Manila‌‌City.)‌  ‌

 ‌

   ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌
 ‌

You might also like