Part 5: Writing the Algorithm of Computer Programming Techniques

Computer Programming Techniques

Writing an Algorithm

A finite set of steps that must be followed to solve any problem is called an algorithm. Algorithm is generally developed before the actual coding is done. It is written using English like language so that it is easily understandable even by non-programmers.

Sometimes algorithms are written using pseudocodes, i.e. a language similar to the programming language to be used. Writing algorithm for solving a problem offers these advantages −

  • Promotes effective communication between team members
  • Enables analysis of problem at hand
  • Acts as blueprint for coding
  • Assists in debugging
  • Becomes part of software documentation for future reference during maintenance phase

These are the characteristics of a good and correct algorithm −

  • Has a set of inputs
  • Steps are uniquely defined
  • Has finite number of steps
  • Produces desired output

Example Algorithms

Let us first take an example of a real-life situation for creating algorithm. Here is the algorithm for going to the market to purchase a pen.

Step 4 in this algorithm is in itself a complete task and separate algorithm can be written for it. Let us now create an algorithm to check whether a number is positive or negative.

Key Method for creating Algorithm

The educator guides   through expressing procedures as algorithms and then testing, comparing, and debugging algorithmic approaches.

Method Components

Decomposing problems

Before creating an algorithm,   need to first break down the problem or task want to express. Breaking down a problem or task into smaller parts or steps that are easier to understand is also known as decomposition. Think about a daily task or routine that you perform, such as cooking a meal. What smaller steps make up this task?

Decomposition is an important skill that cuts across grade levels and across content areas. For example, when working on a project or paper, it is helpful for   to decompose, or break down, the task down into smaller, more manageable chunks. Think about your classroom. What problems or tasks might behelpful for your   to decompose? At the elementary level, for instance,   could break down a daily routine, like getting ready for school, into smaller tasks or parts. Or in a middle school art class,   may decompose a painting or an image to analyze its component parts.

Expressing procedures as algorithms

We need to give it step-by-step instructions, or an algorithm, that clearly explain exactly how we want it to solve a problem. Think about an algorithm for cooking a meal, instance. What are the steps in this process? In what order do these steps need to be carried out? How might you communicate these steps to another human so that they could perform them? Algorithms can be expressed in a variety of ways including non-computer languages such as prose, flowcharts, pseudocode, or oral language.

There are several educational reasons for thinking about procedures as algorithms. For example, programming a computer to find the average of a list of numbers is an excellent way for   to develop an understanding of how to calculate averages.

Testing, comparing, and debugging algorithms

Once an algorithm has been designed, it is important to test the algorithm. Does the algorithm solve every aspect of the problem? Is it efficient? Is it easily understood by a peer or a computer? Testing and comparing algorithms will allows   to find and fix any errors, also known as debugging.

Suggested implementation

  1. Before teaching the lesson, carefully read the submission instructions and consider what evidence you will need to gather for your submission.
  2. Choose an open-ended problem which is important to your subject area and relevant to your .
  3. Find a computational tool or a non-computational environment in which  can implement various solutions to the problem. For example,   can test their algorithms in a computational environment like Scratch or via an unplugged simulation in the classroom setting.
  4. Plan a lesson in which  test, compare, and debug algorithms to solve the problem. Suggested outline:
    • Facilitate a brief discussion of possible approaches to decomposing the problem.
    • Introduce the tool the  will be using to test their algorithms and model the process they will be using.
    • Allow  to work in small groups to build and test algorithms on their own. As they work on this task, have   express their algorithms in a less formal medium, such as a list of verbal commands or a flowchart.
    • If appropriate, allow  to test and compare the performance of their algorithms against each other. If time allows, ask   to debug and iterate on their algorithms.
    • Ask  to share their algorithms, explain how they work, and evaluate their performance.

 

0 Comments

You may find interest following article

Chapter 4 Relational Algebra

Relational Algebra The part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formula and equations. Ex: (x + y) · z = (x · z) + (y · z). The main application of relational algebra is providing a theoretical foundation for relational databases, particularly query languages for such databases. Relational algebra...

Chapter 3 Components of the Database System Environment

Components of the Database System Environment There are five major components in the database system environment and their interrelationships are. Hardware Software Data Users Procedures Hardware:  The hardware is the actual computer system used for keeping and accessing the database. Conventional DBMS hardware consists of secondary storage devices, usually...

Chapter 2: Database Languages and their information

Database Languages A DBMS must provide appropriate languages and interfaces for each category of users to express database queries and updates. Database Languages are used to create and maintain database on computer. There are large numbers of database languages like Oracle, MySQL, MS Access, dBase, FoxPro etc. Database Languages: Refers to the languages used to...

Database basic overview

What is DBMS? A Database Management System (DBMS) is a collection of interrelated data and a set of programs to access those data. Database management systems (DBMS) are computer software applications that interact with the user, other applications, and the database itself to capture and analyze data. Purpose of Database Systems The collection of data, usually...

Laravel – Scopes (3 Easy Steps)

Scoping is one of the superpowers that eloquent grants to developers when querying a model. Scopes allow developers to add constraints to queries for a given model. In simple terms laravel scope is just a query, a query to make the code shorter and faster. We can create custom query with relation or anything with scopes. In any admin project we need to get data...