chap data structures and algorithms algorithmsan algorithm is method or process followed to solve problem if the problem is viewed as functionthen an algorithm is an implementation for the function that transforms an input to the corresponding output problem can be solved by many different algorithms given algorithm solves only one problem ( computes particular functionthis book covers many problemsand for several of these problems present more than one algorithm for the important problem of sorting present nearly dozen algorithmsthe advantage of knowing several solutions to problem is that solution might be more efficient than solution for specific variation of the problemor for specific class of inputs to the problemwhile solution might be more efficient than for another variation or class of inputs for exampleone sorting algorithm might be the best for sorting small collection of integersanother might be the best for sorting large collection of integersand third might be the best for sorting collection of variable-length strings by definitionan algorithm possesses several properties something can only be called an algorithm to solve particular problem if it has all of the following properties it must be correct in other wordsit must compute the desired functionconverting each input to the correct output note that every algorithm implements some function because every algorithm maps every input to some output (even if that output is system crashat issue here is whether given algorithm implements the intended function it is composed of series of concrete steps concrete means that the action described by that step is completely understood -and doable -by the person or machine that must perform the algorithm each step must also be doable in finite amount of time thusthe algorithm gives us "recipefor solving the problem by performing series of stepswhere each such step is within our capacity to perform the ability to perform step can depend on who or what is intended to execute the recipe for examplethe steps of cookie recipe in cookbook might be considered sufficiently concrete for instructing human cookbut not for programming an automated cookiemaking factory there can be no ambiguity as to which step will be performed next often it is the next step of the algorithm description selection ( the if statements in javais normally part of any language for describing algorithms selection allows choice for which step will be performed nextbut the selection process is unambiguous at the time when the choice is made