Algorithm

me ami belong to computer stream , often hear my teachers talking about taking important lectures(that i somehow n accidentally happen to skip) on algorithms , so here i am filling up on those missed lectures ;)

so getting back to the TOPIC

what's an algorithm ???

Lets say an algorithm is  any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output.

so its just like those maths sums that we've been solving all our lives, 
those are just fool-proof steps that run around in a loop while the computer does the calculations.....
for example:- say a linear search ....
basically its the most basic and the simplest of all....
just to summarize :- we go through the values one-at-a-time in a linear way (be it ascending or descending-but mostly ascending)

say example we need to find number 6 from a given set of numbers(let the numbers be in an array) [8,1,4,9,4,8,7,2,4,2]
here we know each array has index starting from 0.....

for(i=0;i<9;i++)
{
     if(array[i]==6)
             sysout->number present
     else
           sysout->number not found
}

here the algo will start with a[0] i.e. 8 and keep on incrementing  itself till the end of that array...
output:- number not found 

i'll try to get back with more algorithms as i myself learn them, but as i dont happen to be a nerd this can supposedly take a long time , ask me about the #games and i'm there but these studies ,,, 
whuff - gimme a break :p

Comments

Popular posts from this blog

NASM: program to find largest number from an array of 32-bit numbers(hard-coded)

Rules for drawing a FLOWCHART