for the most part, programming is writing algorithms. An algorithm is just a sequence of instructions designed to get a desired result.
lets write an algorithm for finding the largest number in a list of numbers:
You have a list called numberList and it has a bunch of random numbers stored in it. The only way you can find the largest number is if you go through every element in numberList. Since we don't know anything about any of the numbers in numberList (they could all be the same) lets just call the first element in the list our currentLargest. As we traverse through numberList, if we come across a number larger than our currentLargest then we assign the new number as our currentLargest. Once we have looked at every element in the numberList, our currentLargest should be the largest number in numberList.
The code for the above program would look something like this [Pseudocode]:
numberList = {1, 39, 8, 109, ...}
currentLarget = numberList0
FOR every element in numberList
. . . IF element > currentLargest
. . . . . . currentLargest = element
PRINT currentLargest
The process of writing an algorithm is just taking your problem, and breaking it down, abstracting it to be able to be solved without a computer. Then you can translate those steps into code.
Quickly, the best reference I can point you to would be Banfa's Tutorial
[ http://bytes.com/topic/c/insights/641516-tutorial-1-what-programming ]
over in the C/C++ Articles Section.
Have a look at a recipe for baking a cake; it's a set of instructions that you should
follow/perform in order to obtain a cake without buying one. Algorithms are
similar sets of instructions for computers.
Writing code is the process of implementing an algorithm in a specific programming language.
You can represent an algorithm by three different ways: 1. Pseudo Code 2. Structured flow charts 3. Actual code
Because fuuck you !!
An algorithm is written in simple English and is not a formal document. An algorithm must: - be lucid, precise and unambiguous - give the correct solution in all cases - eventually end Also note it is important to use indentation when writing solution algorithm because it helps to differentiate between the different control structures. 1) Finiteness: - an algorithm terminates after a finite numbers of steps. 2) Definiteness: - each step in algorithm is unambiguous. This means that the action specified by the step cannot be interpreted (explain the meaning of) in multiple ways & can be performed without any confusion. 3) Input:- an algorithm accepts zero or more inputs 4) Output:- it produces at least one output. 5) Effectiveness:- it consists of basic instructions that are realizable. This means that the instructions can be performed by using the given inputs in a finite amount of time.
algorithms is language independent
Writing code is the process of implementing an algorithm in a specific programming language.
1 Define the problem 2 Analyze the problem 3 Develop an algorithm/method of solution 4 Write a computer program corresponding to the algorithm 5 Test and debug the program 6 Document the program (how it works and how to use it)
You can represent an algorithm by three different ways: 1. Pseudo Code 2. Structured flow charts 3. Actual code
The Algorithm - 2013 was released on: USA: 5 April 2013
There is no specific Hard and Fast rule for writing algorithm. The normal method is the following: 1. get a problem 2. find or invent an algorithm to solve it 3. implement the algorithm in a programming language (C, for example)
2 + 2 x 5 x 6 x 8 x 7 is the algorithm for that
The full Question...Suppose 3 algorithms are used to perform the same task for a certain number of cycles. Algorithm A completes 3 cycles in one minute. Each of Algorithm B and Algorithm C respectively completes 4 and 5 cycles per minute. What is the shortest time required for each Algorithm to complete the same number of cycles?
An algorithm is an abstract set of rules used to solve a specific problem. Pseudocode is just one of many ways to represent an algorithm.
Because fuuck you !!
pseudocode, flow charts, strewing the remains of a dead cat on a sidewalk. pick your poison.
You can represent an algorithm by three different ways: 1. Pseudo Code 2. Structured flow charts 3. Actual code
alphabetically