In the modern internet world man feels that just by entering what he wants to search into the computers he can get information as desired by him. He believes that, this is done by computer. A common man seldom understands that a man made procedure called search has done the entire job and the only support provided by the computer is the executional speed and organized storage of information.
In the above instance, a designer of the information system should know what one frequently searches for. He should make a structured organization of all those details to store in memory of the computer. Based on the requirement, the right information is brought out. This is accomplished through a set of instructions created by the designer of the information system to search the right information matching the requirement of the user. This set of instructions is termed as program. It should be evident by now that it is not the computer, which generates automatically the program but it is the designer of the information system who has created this.
arrow to indicate Thus, the program is the one, which through the medium of the computer executes to perform all the activities as desired by a user. This implies that programming a computer is more important than the computer itself while solving a problem using a computer and this part of programming has got to be done by the man behind the computer. Even at this stage, one should not quickly jump to a conclusion that coding is programming. Coding is perhaps the last stage in the process of programming. Programming involves various activities form the stage of conceiving the problem upto the stage of creating a model to solve the problem. The formal representation of this model as a sequence of instructions is called an algorithm and coded algorithm in a specific computer language is called a program.
arrow to indicate One can now experience that the focus is shifted from computer to computer programming and then to creating an algorithm. This is algorithm design, heart of problem solving.
Characteristics of Algorithm
Let us try to present the scenario of a man brushing his own teeth(natural denture) as an algorithm as follows. Step 1. Take the brush Step 2. Apply the paste Step 3. Start brushing Step 4. Rinse Step 5. Wash Step 6. Stop If one goes through these 6 steps without being aware of the statement of the problem, he could possibly feel that this is the algorithm for cleaning a toilet. This is because of several ambiguities while comprehending every step. The step 1 may imply tooth brush, paint brush, toilet brush etc. Such an ambiguity doesn’t an instruction an algorithmic step. Thus every step should be made unambiguous. An unambiguous step is called definite instruction. Even if the step 2 is rewritten as apply the tooth paste, to eliminate ambiguities yet the conflicts such as, where to apply the tooth paste and where is the source of the tooth paste, need to be resolved. Hence, the act of applying the toothpaste is not mentioned. Although unambiguous, such unrealizable steps can’t be included as algorithmic instruction as they are not effective. The definiteness and effectiveness of an instruction implies the successful termination of that instruction. However the above two may not be sufficient to guarantee the termination of the algorithm. Therefore, while designing an algorithm care should be taken to provide a proper termination for algorithm. Thus, every algorithm should have the following five characteristic feature
- Input
- Output
- Definiteness
- Effectiveness
- Termination
- Let the value of the first be the largest value denoted by BIG
- Let R denote the number of remaining numbers. R=n-1
- If R != 0 then it is implied that the list is still not exhausted. Therefore look the next number called NEW.
- Now R becomes R-1
- If NEW is greater than BIG then replace BIG by the value of NEW
- Repeat steps 3 to 5 until R becomes zero.
- Print BIG
- Stop
- A conditional statement has the following form
- The two types of loop structures are counter based and conditional based and they are as follows
- For variable = value1 to value2 do
- There are two types of conditional looping, while type and repeat type.
- Repeat
- An algorithm that inputs three numbers and outputs them in ascending order.
- To test whether the three numbers represent the sides of a right angle triangle.
- To test whether a given point p(x,y) lies on x-axis or y-axis or in I/II/III/IV quadrant.
- To compute the area of a circle of a given circumference
- To locate a specific word in a dictionary.
Continue on original source http://www.onestopgate.com/gate-study-material/computer/ada/2.1.asp
| < Prev | Next > |
|---|








