Skip to main content

ass-1 ass-2


Algorithm:
Algorithm is the step by step procedure to solve a problem. It gives the logic of the program and how to get a solution to the problem.
An algorithm must have the following characteristics.
·        Be precise (accurate).
·        Be unambiguous (no doubt or leading to one conclusion).
·        No instruction must be repeated infinitely.
·        After the algorithm is terminated, desired result must be obtained.

Control structures used in algorithm:
An algorithm has finite number of steps and may involve decision making and repetition. An algorithm uses three control structures. They are
1. Sequence
2. Decision
3. Repetition
1. Sequence:
Sequence means that each step of the algorithm is executed in the specified order.
Ex: Algorithm to add two numbers.
Step 1: Input the first number as A.
Step 2: Input the second number as B.
Step 3: Set sum=A+B.
Step 4: Print sum.
Step 5: End.
2. Decision:
Decision statements are used when execution of a process depends on some condition. A condition here may evaluate either a true value or a false value. A decision statement can be stated in the following way.
      if condition
         then process1
     else process 2
here if the condition is true, then process1 is executed otherwise process2 is executed.
Ex: Algorithm to check equality of two numbers.
Step 1: Input the first number as A.
Step 2: Input the second number as B.
Step 3: if A=b
             Then print “equql”.
            else
            print “ not equql”.
Step 4: End.
3. Repetition:
Repetition involves executing one or more steps for a number of times. They use constructs such as while, do-while and for loops. Loops execute one or more steps until the given condition is true.
Ex: Algorithm that prints the first 10 natural numbers.
Step 1: [initialize] set I=1, N=10.
Step 2: repeat step 3 and 4 while I<=N.
Step 3: Print I.
Step 4: set I=I+1.
Step 5: End.

Write an algorithm to find the larger of two numbers.
    Solution:
Step 1: Input the first number as A.
Step 2: Input the second number as B.
Step 3: if a>b
             then print a.
            else if a<b
            print b.
            else
            print “the numbers are equal”.
Step 4: End.



Flow charts:

A Flow chart is a graphical or symbolic representation of a process. Each step in the flow chart is represented by a different symbol. The symbols in the flowchart are given below.
1. Start or End symbol: these are represented in rounded rectangle shape or oval shape. These are the first and last symbols in a flowchart.
 



2. Arrows: These are used to represent the flow of control of the program. They tell the exact sequence in which the instructions are executed.






3. Processing step: It is represented using a rectangle. In this step data process such as add, subtract, logic operations etc are carried out.
 

                                                 
4. Input/output symbols: These are represented using a parallelogram. Inputs given by users and output obtained are represented in them.


5. Decision symbol: It is represented by using a diamond symbol. Conditions that require decisions are represented here. True or false are represented by arrows.





6. Connector: It is represented using a circle. Generally used to connect flowchart from one page to another page.
 


Significance of flowcharts:
1. A flowchart is a diagrammatic representation that tells the sequence of steps that solves a problem.
2. It acts as communication between programmers and users.
3. When flowchart is drawn, the problem and solution is easily understood.
4. Flowchart follows the top-down approach in solving problems.
Advantages:
1. Flowcharts are good communication tools to explain logic of problem.
2. Also used for program documentation.
3. Act as a guide (or) blue print for programmers to code the solution of program.
4. Used to debug programs that have errors.
Limitations:
1. Drawing flowcharts is time consuming activity.
2. Flowchart of complex program becomes complex and confusing.
3. A little bit of alternation in the solution may require re-drawing of flowchart.




Generations of Programming Languages:
Programming languages are primary tools for creating software. There are five generations of programming languages. They are machine language, assembly language, high-level language, very high level language and fifth generation language.
1. First generation: machine language
Machine language is the lowest programming language and is the only language the computer understands. All the commands and data values are expressed in 0’s and 1’s.
Advantages:
·        Code can be directly executed by the computer.
·        Execution is fast and efficient.
·        Programs written save space in memory.
Disadvantages:
·        Code is difficult to write.
·        Code is difficult to understand.
·        It is difficult to detect and correct errors.
·        Code is machine dependent.
2. Second generation: assembly language
Second generation programming languages contain assembly languages. Assembly languages are symbolic programming that use symbolic notations to represent machine language instructions.
Advantages:
·        It is easy to understand.
·        It is easy to write programs.
·        It is easy to detect and correct errors.
·        It is easy to modify.
·        It gets less errors.
 Disadvantages:
·        Programmers must have good knowledge of the hard ware and internal architecture of the CPU.
·        Code cannot be directly executed by the computer.
Assembler:
Computer can execute only codes written in machine language. A special program, called assembler is required to convert the code written in assembly language into machine language which contains only 0’s and 1’s.
3. Third generation: high level language
Third generation programming languages are refinement to second generation. The third generation were introduced to make the languages more programmers friendly. Some high level language are BASIC, PASCAL, FORTRAN, C++, JAVA etc. A translator is needed to translate high-level language into computer executable code. Such translators are commonly known as compliers and interpreters.
Advantages:
·        The code is machine independent.
·        It is to use and learn the language.
·        There are few errors.
·        It is easy to document and understand the code.
·        It is easy to maintain, detect and correct errors.
Disadvantages:
·        Code may not be optimised.
·        Code is less efficient.
·        It is difficult to write code that controls CPU, memory and registers.
Compiler:
A complier is a special type of program that transforms the source code written in highlevel programming language into machine language. The code is in 0’s and 1’s is known as object code. Complier can locate syntax errors in the program.
Interpreter:
Interpreter also executes instructions written in high level languages. Interpreter translates the instructions into an intermediate form, which it then executes. Complied program executes faster than interpreted program.
Difference between compliers and interpreters
Complier
Interpreter
It translates entire program in one go.
It interprets and executes one statement at a time.
It generates errors after translating the program.
It stops translation after getting the first error.
Execution of code is faster.
Execution of code is slower.
An object file is generated.
No object file is generated.
Code need not to be complied every time it is executed.
Code is reinterpreted every time it is executed.
It requires more memory space.
It requires less memory space.
Linker:
A linker is a program that combines object modules to form an executable program. When the source code is converted into object code, all the modules need to be put together which is done by linker.
Loader:
A loader is a special type of program that copies programs from a storage device to the main memory when they can be executed.
4. Fourth generation: very high level language
With each generation programming languages started becoming easier to use. Fourth generation languages are little different from their past generation because they are non procedural. The characteristics of fourth generation languages are
·        The instructions of the code are written in English like sentences.
·        They are non-procedural.
·        In aspect of task user concentrate on ‘what’ instead of ‘how’.
·        Code written is easy to maintain.
·        In this generation the code increases the productivity of the programmers.
Ex: sql etc
5. Fifth generation:
 Fifth generation programming languages are centred on solving problems using the constraints given to program rather than using algorithm written by a programmer. Most constraint based and logic programming languages and some declarative languages form a part of fifth generation languages. These languages are widely used in artificial intelligence research. They also contain visual tools to develop a program.
Ex: visual basic, prolog, ops5, mercury etc.


Design And Implementation Of Correct, Efficient And Maintainable Programs
The entire program or software (collection of programs) development process is divided in to a number of phases, where each phase performs a well- defined task.
Requirements analysis:
 In this phase, the user’s expectations are gathered to understand why the program or software has to be developed. Then, all the gathered requirements are analyzed and the scope or objective of the overall software product is penned down. The last activity in this phase involves documenting every identified requirement of the user in order to avoid any doubts or uncertainty regarding the functionality of the program. The functionality, capability, performance, and availability.


Design:
The requirement documented in the previous phase act as the input to the design phase. In this phase, a plan of actions is made before the actual development process starts. This plan will be followed throughout the development process. Moreover, in the design phase, the core structure of the software or program is broken down in to modules. The solution of the program is then specified for each module in the form of algorithms or flow charts. The design phase therefore specifies how the program or software will be developed.
Implementation:
In this phase, the designed algorithms are converted in to program code using any of the high level languages. The particular choice of language will depend on the type of program such as whether it is a system or an application program. C is preferred for writing system programs, whereas Visual basic might be preferred for an application program. The program codes are tested by the programmer to ensure their correctness.
Testing:
In this phase, all the modules are tested together to ensure that the overall system works well as a whole product. In this phase, the software is tested using a large number of varied inputs, also known as test data, to ensure that the software is working as expected by the user’s requirements identified in the requirements analysis phase.
Software deployment, training, and support:
After the code is tested and the software or the program is approved by the user’s it is then installed or deployed in the production environment.
Software training and support is a crucial phase. Program designers and developers spend a lot of time creating the software, but if nobody in the organization knows how to use it or to fix certain problems , then no one will want to use it.
Maintenance:

Maintenance and enhancements are ongoing activities that are done to cope with newly discovered problems or new requirements. Such activities may take a long time to complete.

Comments

  1. Though the technical glitch scared a lot of people. It was just a publicity stunt to make the event even more interesting. The intention was good the question is. Is it necessary to make a fuss just before the big event? I don't think so.jogos friv gratis 2019
    Jogos 2019
    jogos friv
    abcya free games only

    ReplyDelete
  2. Hey there! I know this is kinda off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I'm using the same blog platform as yours and I'm having trouble finding one? Thanks a lot! apple hilfe telefon berlin

    ReplyDelete

Post a Comment

Popular posts from this blog

Characteristics of computers

    Characteristics:        All computers have similar characteristics, which tells how computers are efficient to perform task. Computers have some Limitations also. Speed:     Computer can work very fast. It takes only few seconds for calculations on very large amount of data. Computer can perform millions (1,000,000) of instructions per second.      We measure the speed of computer in terms of microsecond (10-6 part of a second) or nanosecond (10 to the power -9 part of a second).   Accuracy:        The degree of accuracy of computer is very high and every calculation is performed with the same accuracy.  The errors in computer are due to human and inaccurate data.       The calculation done by computer are 100% error free, If we provide accurate input. Diligence:        A computer is free from tiredness, lack of concentration...

DS LAB FOR II YEAR

1.SINGLE LINKED LIST Procedure for creation of single linked list: STEP-1 : Declaring a variable named as “item”.Ie the element what we place in the linkedlist of the new node.         STEP-2 : Read the value   in “item”. Set first=last=null and next=null. STEP-3: Create a new node named as temp and assign the variable item to data part andassign Address of the node temp to null.       temp.data=item;       temp.next=null; STEP-4: Check   the address part of the first node Check if first=null Then assign first=last=temp Other wise Then assign the new node tolast.next=temp          last=temp STEP-6 : Repeat STEP-3 until you read required nodes. Procedure for display the linked list: STEP-1 : Check whether the list having nodes or not i.e Check if first=null        ...

LEVELS AND CURVES

LEVELS:                 Levels are used to set the shadows, mid tone etc.  O pen an image on Photoshop window. Select image menu on menu bar than adjustments than levels. A dialogue box will appear on screen which shows three pointers which indicates three optimum. The black triangle indicates shadows and gray triangle indicates mid tone and white triangle indicates highlights. In the channel menu different options are provided in drop down list. Make sure select on preview, which gives current adjustments on your picture. CURVES: Curves are to  similar to levels, it gives more power to control shadows highlights and mid tones. One of the simplest adjustment we can make with curves is increasing the contrast. Go to image menu and than adjustments,than curves. Dialogue box will appear on screen with straight diagonal line.      ...