Showing posts with label FPL. Show all posts
Showing posts with label FPL. Show all posts

Wednesday, 20 March 2019

Introduction to Programming Languages Hardcover – Import, 29 Jun 2017 by Arvind Kumar Bansal (Author)

In programming courses, using the different syntax of multiple languages, such as C plus plus, Java, PHP, and Python, for the same abstraction often confuses students new to computer science. Introduction to Programming Languages separates programming language concepts from the restraints of multiple language syntax by discussing the concepts at an abstract level. Designed for a one-semester undergraduate course, this classroom-tested book teaches the principles of programming language design and implementation. 
It presents: Common features of programming languages at an abstract level rather than a comparative level The implementation model and behavior of programming paradigms at abstract levels so that students understand the power and limitations of programming paradigms Language constructs at a paradigm level A holistic view of programming language design and behavior To make the book self-contained, the author introduces the necessary concepts of data structures and discrete structures from the perspective of programming language theory. 
The text covers classical topics, such as syntax and semantics, imperative programming, program structures, information exchange between subprograms, object-oriented programming, logic programming, and functional programming. It also explores newer topics, including dependency analysis, communicating sequential processes, concurrent programming constructs, web and multimedia programming, event-based programming, agent-based programming, synchronous languages, high-productivity programming on massive parallel computers, models for mobile computing, and much more. 
Along with problems and further reading in each chapter, the book includes in-depth examples and case studies using various languages that help students understand syntax in practical contexts.
Buy :

Introduction to Programming Languages Hardcover – Import, 29 Jun 2017 by Arvind Kumar Bansal (Author) 


PDF Download :


Introduction to Programming Languages Hardcover – Import, 29 Jun 2017 by Arvind Kumar Bansal (Author)


Foundations of Programming Languages (Undergraduate Topics in Computer Science) Paperback – Import, 20 Dec 2017 by Kent D. Lee (Author)

This clearly written textbook provides an accessible introduction to the three programming paradigms of object-oriented/imperative, functional, and logic programming. Highly interactive in style, the text encourages learning through practice, offering test exercises for each topic covered. 
Review questions and programming projects are also presented, to help reinforce the concepts outside of the classroom. This updated and revised new edition features new material on the Java implementation of the JCoCo virtual machine.
Topics and features: includes review questions and solved practice exercises, with supplementary code and support files available from an associated website; presents an historical perspective on the models of computation used in implementing the programming languages used today; provides the foundations for understanding how the syntax of a language is formally defined by a grammar; illustrates how programs execute at the level of assembly language, through the implementation of a stack-based Python virtual machine called JCoCo and a Python disassembler; introduces object-oriented languages through examples in Java, functional programming with Standard ML, and programming using the logic language Prolog; describes a case study involving the development of a compiler for the high level functional language Small, a robust subset of Standard ML.Undergraduate students of computer science will find this engaging textbook to be an invaluable guide to the skills and tools needed to become a better programmer. While the text assumes some background in an imperative language, and prior coverage of the basics of data structures, the hands-on approach and easy to follow writing style will enable the reader to quickly grasp the essentials of programming languages, frameworks, and architectures.

Buy :

Foundations of Programming Languages (Undergraduate Topics in Computer Science) Paperback – Import, 20 Dec 2017 by Kent D. Lee (Author) 


PDF Download :


Foundations of Programming Languages (Undergraduate Topics in Computer Science) Paperback – Import, 20 Dec 2017 by Kent D. Lee (Author)




Saturday, 31 March 2018

Program Documentation

What is Documentation ?
  
Documentation consists of instructions for using a computer device of program.
  
Documentation can appear in a variety of forms, the most common being manuals.
  
When you buy a computer product (hardware or software), it almost always comes with one or more manuals that describe how to install and operate the product.
  
In addition, many software products include an online version of the documentation that you can display on your screen or print out on a printer.
  
A special type of online documentation is a help system, which has the documentation embedded into the program.

Documentation is often divided into the following categories

1) Installation : Describes how to install a program or device but not now to use it.
2) Reference : Detailed descriptions of particular items presented in alphabetical order. Reference documentation is designed for people who are already somewhat familiar with the product but need remainders or very specific information about a particular topic.
3) Tutorial : teaches a user how to use the product. Tutorials move at a slower pace than reference manuals and generally contain less detail.

Need for Documentation
  A software cannot be considered to be complete until it is properly documented. So proper documentation of software is necessary due to the following reasons.

More documentation means easier usage. As soon as a user gets stuck trying to get a program feature to work, he or she starts to read that program's documentation. Therefore, creating well-structured and well-written documentation will make it easy for the user to get that feature to work.

It makes program or software is easy to maintenance.

A well documented software is easy ti modify and maintain in the future.

It is easier to understand the logic of a program  from the documented records rather than its code.

Flowcharts or comments used within the programs are very helpful in understanding the functionality of the whole program. 

Documented records are quite helpful in restarting a software project that was postponed due to some reason or the other.

The job need not be started from scratch and the old ideas may still be easily recapitulated which saves lot of time and avoids duplication of work.(Reusability).

In general the following aspects of a program or project should be documented

1) Basic usage is mostly covered in a man page.
2) More advanced usage can be achieved by giving options in the documentation and giving examples on how to use them (take the very good Apache documentation for example).
3) Source code, of course, because somebody may want to add features to the program.
4) Example of usage (what input to give and expected output) to supply a working basic configuration file and document it heavily.
5) Installation of the program, because not all program work with easy ways.

Forms of Documentation
  The three commonly used forms for documenting software are-
Comments
  Comments can be useful for
  1. Describing an element
  2. Adding remarks and lists
  3. Describing parameters
  4. Describing methods/properties
  5. Providing examples
  6. Compiling the code.

System Manual
  A document which is used to maintain all the system details and its usage is a system manual. It consist of 

 1. The objectives of developing the software and its usefulness to various categories of users.
 2. Specifies program names along with their description and purpose.
 3. Detailed system flow charts cross-referenced to the listing.
 4. A source listing of all programs together with full details of any modifications made since.
 5. Specimen of all input forms and printed output records.

User Manual

 A document which is used by the user for understanding easy use(how to use) of any product is a user manual. It consists of-

 1. Operational details of each program.
 2. Loading and unloading procedures.
 3. Starting, running, and terminating procedures.
 4. A description and example of any control statement that may be used.
 5. List of errors condition with explanations for their re-entry into the system.
 6. List of program to be executed before and after execution of each program.

Thursday, 29 March 2018

Concept of API / Libraries

Application Programming Interface (API) is an interface in computer science that defines the ways by which an application program may request services from libraries and/ or operating system.It is a set of routines, protocols and tool for building software applications.
  
A good API makes it easier to develop a program by providing all the building blocks.
   
Although APIs are designed for programmers, they are ultimately good for users because they guarantee that all program using a common API will have similar interface. This makes it easier for users to learn new programs.

Concept of  'C' Library
   The C standard library consists of a set of sections of the ISO C standard which describe a collection of header files and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

Following are some important header files :

   Stdio.h, which stands for "standard input/output header" , is the header in the C standard library that contains macro definitions, constant and declarations of functions and types used for various standard input and output operation.
   
   String.h is the header in the C standard library for the C programming language which contains macro definition, constant and declarations of functions and types used not only for string handling but also various memory handling functions; the name is thus something of a misnomer.

    Function declared in string.h are extremely popular, since as a part of the standard library, they are guaranteed to work on any platform which supports C.
  
    Math.h is a header files in the standard library of C programming language designed for basic mathematical operation. Most of the functions involve the use floating point numbers. C++ also implements these functions for compatibility reasons and declares them in the header cmath.

Debugging a Program for Syntax Errors and Logical Errors


Debugging a Program for Syntax Errors
As compared to logical errors, syntax errors are much easier to locate and correct because almost all language processor are designed to detect syntax errors automatically.

A single syntax error often cause multiple error messages to be generated by the language processor.

Removal of the syntax error will result in the removal of all associated error messages.

Debugging a Program for Logical Errors
  Logical errors are much more difficult to detect the syntax errors as computer does not produce any error message for such errors.
  
One or more following methods are commonly used to detect the logical errors :
      
Doing hand simulation of the program code :
 One approach is to take the printout of the source code of the program and go through its execution manually with the test data input that produced incorrect results.
       
Putting the print statement in the program code
Another approach is to put several print or write statements at appropriate locations in the program so that the values of different variables can be displayed to indicate intermediate computations results.

  Using a debugger :
    This is the most commonly used approach. Debugger is the software program the assist a programmer in following a program's execution step-by-step allowing him to display intermediate calculation results.
    
Using memory dump :
     This approach is used when the program "hang up" during a test run.

Testing a Program

For most programs, it is practically impossible to prove that the program is correct on all inputs.Instead, you must try to convince skeptics that it mostly works right, by testing the program on various inputs and documenting what you have done.

This documentation is called a test plan and you must provide one with each program.

The test plan describes how you intend to test your program, that is, which inputs you plan to test it on and why those are good choices.

The results of running a set of tests is a test log, which shows the results produced by the tests in the test plan. The log should demonstrate that each test produced the output predicted by the test plan.

Developing a Test Plan
  The programs written for this course will require you to test the execution of your programs on various sets of inputs to demonstrate program functionality. These input sets or test cases, will be of your own choosing, but the following guidelines should be followed :

        Input sets should be ordered logically, preferably in the same order as the code being tested.

        When there are only a few possible inputs, test them all.

        If your program does not handle certain inputs, the ASSUMPTIONS section of the program header must indicate precisely which inputs are not handled in the program.

Format for Program Test Document
  Test results must be submitted separately on paper, even if the program may be submitted on disk or electronically. The program test document should be organized as follows :
    1. Your name ( and the names of any people you work with).
    2. The name of the programming assignment (e.g., Program 1).
    3. Rationale behind chosen test cases(inputs). Note that you MUST include some justification for each test case, even if it is something as simple as testing the program on odd or even numbers.
    4. Printouts of output files for each separate input set (i.e., test logs).


Program Testing and Debugging

A software bug (or just "bug") is an error, flaw, mistake, failure, fault or "undocumented feature" in a computer program that prevents it from behaving as intended (e.g., producing an incorrect result).

Most bugs arise from mistakes and errors made by people in either a program's source code or its design and a few are caused by compilers producing incorrect code.

Formal Program Testing
                The software industry is primarily concern with logical errors and hidden run-time errors. Companies expend enormous effort to find the errors before the release. To fix a bug after the release cost a 100 times more; patches must be designed and ship out.Besides the customer are not very happy. So, there is the necessity of program testing before it goes to the end user.
   The industry is concerned with Verification and Validation :
               Validation or appropriate :
                  Techniques for insuring validation :
                         Inspection code at a high level
                         Have the user/customer test software
                         Requires good software specification

                Verification or correctness :
                         Is the program producing the correct answers ?
                         Techniques for insuring verification :
                              Code walk through of inspection
                              Testing

Testing
    Testing is the primary technique for the above two Vs :
        Testing uses input data and observes output.
             There may be additional output then in the final product.
             The evaluation may include more then just the correctness of the output.
             Testing can be at the component level or integrated level.

Debugging
   Debugging is a methodical process of finding and reducing the number of bugs or defects, in a computer program or a piece of electronic hardware thus making it behave as expected. Debugging tends to be harder when various subsystem are tightly coupled, as changes in one may cause bugs to emerge in another.

Difference between Testing and Debugging



Types of Program Errors
  There are three basic errors :
    1. Syntax/Compilation error
    2. Run-time exception error
    3. Logical error

Syntax / Compilation Error
   Error during compiling prevents getting a compiled code. Modern compilers indicate well the location of the error. Sometimes problems with delineators such as semicolons in C or brackets in C++.

Run-time Exception Error
  When you get an error message while running the compiled code. Java gives good error messages indicating the location of the error but that might not be the location of the actual error.Some languages, such as C seem to have only one type of error; segmentation fault or Fortran, index out of bounds.

Logical Error
  These errors are the hardest to correct or detect. The program "runs" but the output is not correct.
     
Tools for detecting and fixing logical error :
      1. Choose test cases well. Try to cover everything with small cases. Try one big case.
      2. Print intermediate value. Use a boolean variable to turn on and off debug printing.
      3. Walk though. Play computer in front of an audience (if you can) and suspect all code especially uncommitted code.

Logical errors generally occur at :
Loops : 
    Check the range of for loops and the boolean expression of while loop.
  
Ifs :
    Check complicated boolean expressions (more than one variables) and especially if you are using negation.

Tuesday, 27 March 2018

Characteristics of Good Programming Language

There are many programming languages, each corresponding to specific needs (formula calculus, character string processing, real-time, etc.) with each having specific characteristics and functionalities. Therefore, the choice of programming language depends above all on the requirements to be fulfilled as well as the existing resources for understanding and training in the language.

Selection Criteria for a Programming Language

 1. Usability
       Easy to learn, ease of use for an experienced programmer.
 2. Performance
       Speed of program execution, speed of compiler execution (a program which translates the program into machine code), stability (lack of defects).
 3. Portability
       A portable language is one which is implemented in variety of computers (design relatively machine dependent). Well defined language are more portable than others e.g. C, C++.
 4. Extendibility 
        Possibility of developing the language and its implementation, existence function libraries, class libraries, etc.
 5. Continuity
        Continuity of the manufacturer, language continuity, implementation continuity, existence of international standards for defining the language, comformity of implementation by following standards, existence of other manufacturers for that language.

Subprograms
 In computer science, a subroutine or subprogram (also called procedure, method, function, or routine) is a portion of code within a larger program, which performs a specific task and is relatively independent of the remaining code.

As the name "subprogram" suggests, a subroutine behaves in much the same way as a computer program that is used as one step in a larger program or another subprogram.

A subroutine is often coded so that it can be started ("called") several times and/or from several places during a single execution of the program, including from other subroutines, and then branch back (return) to the next instruction after the "call" once the subroutine's task is done.

  There are two distinct categories of subprograms:
    1. Procedures           2. Functions.

Some Most Popular Programming Language

FORTRAN (FORmula TRANslation)
 The name FORTRAN is an acronym for FORmula TRANslation, because it was designed to allow easy translation of math formulas into code.
Often referred to as a scientific language, FORTRAN was the first high-level language, using the first compiler ever developed.Prior to the development of FORTRAN computer programmers were required to program in machine/assembly code, which was an extremely difficult and time consuming task.
The objective during it's design was to create a programming language that would be: simple to learn, suitable for a wide variety of applications, machine independent, and would allow complex mathematical expressions, machine independent, and would allow complex mathematical expressions to be stated similarly to regular algebraic notation. 

COBOL (Common Business Oriented Language)
 COBOL (pronounced / ? ko?b?1/) is one of the oldest programming languages.Its name is an acronym for Common Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments.
The COBOL 2002 standard includes support for object-oriented programming and other modern language features. 
COBOL was an effort to make a programming language that was like natural English, easy to write and easier to read the code after you'd written it.

BASIC (Beginner's All-purpose Symbolic Instruction Code)
 In computer programming, BASIC ( an acronym for Beginner's All-purpose Symbolic Instruction Code) is a family of high-level programming languages.
It is developed to provide computer access to non-science students.
BASIC remains popular to this day in a handful of highly modified dialects and new languages influenced by BASIC such as Microsoft Visual Basic.As of 2006, 59 % of developers for the .NET platform used Visual Basic .NET as their only language.

PASCAL
 Pascal is an influential imperative and procedural programming language designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.
A derivative known as Object Pascal was designed for object oriented programming.

C Language
 C is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C was designed for implementing system software, it is also widely used for developing portable application software.
C is one of the most popular programming languages. It is widely used on many different software platforms.

C++ Language
 C++ (pronounced "C plus plus") is a statically typed, free -form multi-paradigm, compiled, general-purpose programming language.
It is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features.
It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language and originally named "C with Classes". It was renamed to C++ in 1983.

JAVA
 Java is a programming language originally developed by James Gosling at Sun Micro-systems and released in 1995 as a core component of Sun Micro system Java platform.
The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities.
Java application are typically compiled to byte-code (class file) that can run on any Java Virtual Machine (JVM) regardless of computer architecture. 

LISP (LISt Processing)
 Lisp (or LISP) is a family of computer programming languages.
It is the second-oldest high-level programming language in widespread use today.
Lisp was originally created as a practical mathematical notation for computer programs.
The name LISP derives from "LISt Processing" .Linked lists are one of Lisp languages major data structures, and Lisp source code is itself made up of lists.

High-level Programming Language Tools : Compiler , Linker , Interpreter


Compiler 

 Compiler is used to transform a program written in a high-level programming language from source code into object code.

Programmers write programs in a form called source code.Source code must go through several steps before it becomes an executable program.

The first step is to pass the source code through a compiler, which translates the high-level language instructions into object code.

The final step in producing an executable program--after the compiler has produced object code-- is to pass the object code through a linker. The linker combines modules and gives real values to all symbolic addresses, thereby producing machine code.

Linker

 Also called link editor  and binder, a linker is a program that combines objects modules to form an executable program.

Many programming languages allow you to write different pieces of code, called modules, separately.

This simplifies the programming task because you can break a large program into small, more manageable pieces.

Eventually, through you need to put all the modules together.This is the job of the linker.

Interpreter

 An interpreter translates high-level instructions into an intermediate form which it then executes.

Compiled programs generally run faster than interpreted programs.

The advantage of an interpreter, however, is that it does not need to go through the compilation stage during which machine instructions are generated.The process can be time-consuming if the program is long.

The interpreter, on the other hand, can immediately execute high-level programs.

Editor

 An editor is software, where the programmer can write the source code, edit it as well as compile and execute it. Like compilers and interpreters, the editors are also different for different programming languages.

MATLAB

  MATLAB (MATrix LABoratory) is a numerical computing environment and fourth generation programming language, developed by the Math works.

 MATLAB allows matrix manipulation plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs in other languages.

GUI (Graphical User Interface)
 GUI is a program interface that takes advantage of the computer's graphics capabilities to make the program easier to use. Well-designed graphical user interfaces can free the user from learning complex command languages.

Sunday, 25 March 2018

Types of Programming Languages

We classify programming language by their level.
a) Natural Language.
b) Machine level Language
c) High-level Language
d) Assembly level Language
e) Scripting Language

Natural Language
  A language spoken, written or signed by humans for general purpose communication.

Machine Level Language
  It is the lowest-level programming language.
  Machine language are the only language understood by computers.
  Programs written in high-level language are translated into machine language by a compiler.
  A computer's language consists of strings of binary numbers (0,1).

Limitations 
 - In this programming language a programmer has to remember dozens of code numbers or commands in the machine instruction set.
- A programmer has to keep track of the storage locations of data and instructions.
- Modifications of a machine level program and the location of errors in it is a tedious job and can take long time.

Assembly Level Language
  The assembly language is simply a symbolic representation for its associated machine language.
  This representation consists of mnemonic operation codes and symbolic address.
Advantage
 - Less number of errors and also errors are easy to find.
 - Modification of assembly language program is easier than that of machine language program.
Limitation
 - They are machine oriented.

High Level Language (HLL)
  A programming language such as c, FORTRAN, or Pascal that enables programmer to write programs that are more or less independent of a particular type of computer. Such language are considered high-level because they are closer human languages and further from machine languages.

Characteristics of High Level Programming Language
  In computing, a high-level programming language is a programming language with strong abstraction from the details of the computer.
 In comparison to low-level programming language, it may use natural language elements, be easier to use, or be more portable across platforms.
 Such language hide details of CPU operations such as memory access models and management of scope

Scripting Language
  A scripting language is a high-level programming language that is interpreted by another program at runtime rather than compiled by the computer's processor as other programming language (such as C and C++) are.
 Scripting language, which can be embedded within HTML, commonly are used to add functionality to a web page, such as different menu styles or graphic displays or to serve dynamic advertisements. 

What is Programming Language ?

A Programming language is nothing but a vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. The term Programming language usually refers to high-level language, such as BASIC, C, C++.

High-level programming language are more complex than the languages the computer actually understands,called machine language.

Lying between machine language and high-level language are languages called assembly language. Assembly language allow a programmer to substitute names instead of numbers as in machine languages.

Lying above high-level language are languages called fourth-generation languages (usually abbreviated 4GL), represents the class of computer language closest to human languages.

Thursday, 22 March 2018

Pseudo Codes for Basic Logic (Control) Structure

Pseudocode is a compact and informal high-level description of a computer programming algorithm.
  Pseudo-code typically omits details that are not essential for human understanding of the algorithm such as variable declaration, system-specific code and subroutines.
   The purpose of using pseodocode is that it is easier for humans to understand than conventional programming language code.

Sequence Logic
   Sequence logic is used for performing instruction one after another in sequence. The logic flow of pseudo code is from top to bottom.

Selection Logic
  1. If-else
         Selection logic also known as decision logic is used for making decision.It is also called as decision logic.
       It is used for selecting the proper path out of two or more alternative paths in program logic.Selection logic is depicted as an IF.....THEN.....ELSE or on IF.....THEN or a case structure.
    The IF......THEN......ELSE construct says that if condition is true then 
            do process-I else (if condition is not true) do process-II.

  If we simply want do decide if a process is to be performed or not the IF.....THEN structure is used this structure says that if condition is true then do process-I and if it is not true then skip over process-I.

Switch-case
    The case structure is multiple way selection logic structure.The CASE structure indicates that if the value of type is equal to type I execute process-I if it equal to type II executes process II if it equals to type 3 execute process 3 if so on.
                       Fig: Flowchart for 'CASE' selection structure

Iteration (or Looping) Logic

    The looping structures in C are-
                 While loop
                 For loop
                 Do -while loop
                 Repeat-until
  Iteration logic is used to produce loops in program logic when one or more instruction may be executed several times depending on some condition.
    In case Do-WHILE the looping will continue as long as the condition is true the looping steps when the condition is not true.
    Important : Do-while loop is useful when we want the statements within the loop must be executed at least once.
                        Fig: Flowchart for DO-WHILE iteration structure

In case of REPEAT.....UNTIL : The looping continues until the condition becomes true. That is the execution of the statement  within the loop is repeated as long as the condition is not true.

Use of "Go to" Statement

The goto statement is the most basic form of unconditional transfer of control.
  Although the keyword may either be in upper or lower case depending on the language, it is usually
written as:
   goto label

 The effect of a goto statement is to cause the next statement to be executed to be the statement appearing at ( or immediately after ) the indicated label. A label is an explicit name or number assigned to a fixed position within the source code and which may be referenced by control flow statement appearing elsewhere in the source code.

     Goto statement have been considered harmful by many computer scientists, notably Dijkstra.

Importance of use of Indentation in Programming

Remember that indentation is useful for people, not the machine Correct use of identifiers, white space and documentation makes your program easier to understand for those humans reading it. Since you also will be reading your own program, you will want to be consistent and current with your documentation.

  Properties of good style
    1. Program that are easy to read and understand.
    2. Programs that communicate the algorithm used in a form easy to follow.
    3.Programs that are easy to modify and enhance to adapt to new and changing environments.( It is important to keep in mind that the programmer making the modifications may not be the initial author.)

Principles of good style
  1. Clarity and simplicity
         Avoid unnecessary complexity.When possible,use the straight forward method.Don't sacrifice clarity for cleverness.
  2. Use meaningful identifiers
         Choose names for constant, variables,functions,etc. , that accurately describe the purpose of the identifier.For instance, a, x, t are poor identifiers because they are meaningless whereas age, salary, and first_name are good choices.Constant should be all uppercase. Other identifiers should make use of the underscore"_" and uppercase letters to distinguish the words in an identifier (FirstName or first_name but not firstname).
   3. One statement per line
   4. Use proper indentation of control structures.
         Be consistent with indentation.There are several styles to choose from but whichever you choose, be consistent! Some example are given below.Note the placement of the curly braces and the code.

Monday, 19 March 2018

Representation of Algorithm

There were various ways to represent an algorithm:-
   1. As a program
   2. As flowchart
   3. As pseud codes

Program
    A program is set of instruction that are arranged in a sequence that helps computer to solve complex problem.Moreover, the process of writing a program is called Programming.

Flowchart
  A flowchart is nothing but a graphical representation of an algorithm. 
    Flowchart is a representation, primarily through the use of symbols, of the sequence of activities in a system ( process , operation , function or activity ).
  Flowchart uses various graphical symbols. All symbols are connected among themselves to indicate the flow of information and processing.

Flowchart Symbols
  Flowchart symbols are used to represent an algorithm : 

  Terminal:-
       The oval represents any terminal point in a program and generally contains words such as START , END.

Input or Output:-
      The parallelogram represents the input (via keyboard) or Output ( to screen) function.

Process:-
   The rectangle represents the processing operations. For example a = x + y.

Algorithm

An algorithm ( pronounced AL-go-rith-um) is a procedure or formula for solving a problem.A computer can be viewed as an elaborate algorithm.In mathematics and computer science, an algorithm usually means a small procedure that solves a recurrent problem.
    A formula or set of steps for solving a particular problem. To be an algorithm, a set of rules must be unambiguous and have a clear stopping point.Algorithm can be expressed in any language from natural languages like English or French programming language like FORTRAN.
   We use algorithm every day.For example, a recipe for baking a cake in an algorithm.

Advantage of Generalized Algorithm
  It is a foundational element of logic and human reasoning. Generalization points the existence of a domain or set of element, as well as one more common characteristics shared by those elements.
    In the case of certain enumerably infinite sets, we can give explicit instructions for determining the n th member of the set, for arbitrary finite n.Such instruction are to be given quite explicitly, in a form in which they could be followed by a computing machine.

Avoiding Infinite Loops in Algorithm-by Counting
   A loop is a sequence of statement which is specified once but which may be carried out several times in succession.The code "inside" the loop is executed a specified number of times, or once for each of a collections of items, or until some condition is met.
           An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never by met or once that causes the loop to start over.
         To be an algorithm, set of rules must be unambiguous and have a clear stopping point.
  A loop counter value can be used to tell how many times a statement or block of statement is to be execute.

Avoiding Infinite Loops in Algorithm-by using a Sentinel Value
   The following sentinel value are used:-
     The break Statement in Loops :
         A break statement can be used to end a loop immediately.
         A break statement ends only the innermost loop or switch statement that contains the break statement.break statement make loops more difficult to understand.
  The continue statement in Loops:
      A continue statement 
               It ends current loop iteration and Begins the next one.

Popular Posts

Categories

Android (21) AngularJS (1) Books (3) C (75) C++ (81) Data Strucures (4) Engineering (13) FPL (17) HTML&CSS (38) IS (25) Java (85) PHP (20) Python (83) R (68) Selenium Webdriver (2) Software (13) SQL (27)