ALGORITHMS AND FLOWCHARTS IN PROGRAMMING- ESSENTIAL POINTS


  • Flowcharts: A flowchart is a diagram that depicts a process, system or computer algorithm. They are widely used in multiple fields to document, study, plan, improve and communicate often complex processes in clear, easy-to-understand diagrams. They are related to other popular diagrams, such as Data Flow Diagrams (DFDs) and Unified Modeling Language (UML) Activity Diagrams.
  • Flow charts Symbol:
    Symbol Name Symbol
    Terminal/Terminator:
    Process:
    Decision:
    Document:
    Data, or Input/Output:
    Stored Data:
    Flow Arrow:

  • Plan and draw a basic flowchart:
    1. Define your purpose and scope
    2. Identify the tasks in chronological order
    3. Organize them by type and corresponding shape
    4. Draw your chart
    5. Confirm your flowchart

  • An algorithm is a step by step method of solving a problem. It is commonly used for data processing, calculation and other related computer and mathematical operations. An algorithm is also used to manipulate data in various ways, such as inserting a new data item, searching for a particular item or sorting an item.
  • The conversion from text program to binary file is done by another software called Compiler and this process of conversion from text formatted program to binary format file is called program compilation.
  • A data type or simply type is a classification of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support various types of data, for example: charcter, integer or Boolean.
  • A variable is a value that can change, depending on conditions or on information passed to the program.
  • A constant is a value that cannot be altered by the program during normal execution, i.e. the value is constant.
  • An operator in a programming language is a symbol that tells the compiler or interpreter to perform specific mathematical, relational or logical operation and produce final result.
    Types of Operators:
    1. Arithmetic Operators: Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/).
    2. Relational operator: It is a programming language construct or operator that tests or defines some kind of relation between two entities. These include numerical equality (e.g., 5 = 5) and inequalities (e.g., 4 ≥ 3).
    3. Logical operator: These are typically used with Boolean (logical) values. When they are used with boolean values they return a boolean values and if these operators are used with non-Boolean values, they may return a non-Boolean value.
  • Conditional statements: conditional expressions and conditional constructs are features of a programming language, which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.
    Types of Conditional Statements
    • If conditional statements: The if statement evaluates the test expression inside the parenthesis. If the test expression is evaluated to true (nonzero), statements inside the body of if is executed. If the test expression is evaluated to false (0), statements inside the body of if is skipped from execution.
        Variations of If:
      1. if...else statement: An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.
      2. if...elseif...else statement: An if statement can be followed by an optional else if...else statement, which is very useful to test various conditions.
      3. Nested if...else statement: The if...else statement executes two different codes depending upon whether the test expression is true or false. Sometimes, a choice has to be made from more than 2 possibilities. The nested if...else statement allows you to check for multiple test expressions and execute different codes for more than two conditions.
    • A switch statement is an alternative of if statements which allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.
  • Loops are used in programming to repeat a specific block until some end condition is met. There are three loops generally:
    1. For loop: Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
    2. while loop: Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body
    3. do While loop: It is more like a while statement, except that it tests the condition at the end of the loop body.

I am in