Logic Formulation Reviewer PDF
Document Details
Uploaded by LivelyHyperbole
University of Santo Tomas
Tags
Summary
This document acts as a reviewer on logic formulation, introducing algorithms and flowcharts. It details basic symbols and structures, including sequence, selection, and repetition structures. The topics are suitable for an undergraduate introductory computer science class.
Full Transcript
Logic Formulation Reviewer 1. Introduction to Algorithms Definition: An algorithm is a step-by-step processing procedure used to solve problems. Characteristics of Algorithms: ○ Well-defined inputs and outputs ○ Clear and unambiguous ○ Language indepen...
Logic Formulation Reviewer 1. Introduction to Algorithms Definition: An algorithm is a step-by-step processing procedure used to solve problems. Characteristics of Algorithms: ○ Well-defined inputs and outputs ○ Clear and unambiguous ○ Language independent ○ Feasible 2. Flowcharts Definition: A flowchart is a graphical representation of an algorithm. Purpose: To visually depict the flow of control and data through an algorithm, making it easier to understand and analyze. 3. Basic Flowchart Symbols Symbol Description Shapes/charts Data Terminal Defines the starting and ending points of a flowchart Initialization Represents the preparation or initialization of memory space Input/Output Indicates data input and output operations Process Represents manipulation of data (assignments, computations) Decision Processes conditions using relational operators Subroutine/Function Groups sequences performing specific, well-defined tasks Flow Lines Defines the logical sequence of the program On-page Connector Connects flowchart elements on the same page Off-page Connector Connects flowchart elements on different pages 4. Algorithm Structures Sequence Structure: ○ Definition: Represents a flow carried out in a specific, linear order. ○ Example: Store the sum of S = 10 and P = 15 in variable M and print M. ○ Selection Structure: ○ Definition: Represents a flow where processes are selected based on certain conditions. ○ Example: Determine if a given number H = 8 is ODD or EVEN and display the result. ○ Repetition Structure: ○ Definition: Represents a flow where a condition is repeatedly evaluated, and the associated process is executed as long as the condition is true. ○ Example: Print numbers from 1 to 10. ○