1. Soln 1.
"Algorithm"referstothe setof instructions (where eachinstructionhasitsclearand defined
meaning) whichare intendedtosolve the problemwithfinite amountof effortinfinite periodof
time.
OR
In otherwords,AlgorithmmeansStepstoSolve the Problem.The solutiontoeveryproblemhas
stepsassociatedwithitthatare calledAlgorithms.
The characteristicsof Algorithmsare:
1. It shouldalwaysbe of finite lengthandterminatesinfinite no.of stepsandwithinfinite time.
2. It shouldhave 0 or more inputs (takenfromuser) andprovides1or more outputs(inrelationto
input).
3. The operationstobe performedneedstobe verybasicso that theycan be performedeasily&
efficientlyand infinite length.
4. The outputor actionsperformedshouldnotbe vague orunclear.
Soln 2.
Time complexityandSpace complexityare the factorsor part of AlgorithmAnalysis.
Algorithmanalysisisimportantinordertocheck whetherthe algorithmdesignedtosolve the
problemisefficientornot,intermsof Space usedbyit inmemoryandits Runningtime asfunction
of inputsize. We have bestcase (fastest),averagecase (prediction),worstcase (slowest)definedfor
everyalgorithm.
Time Complexityreferstostudyof time efficiencyof analgorithm asa functionof inputtoalgorithm
(no.of inputs) OR Amountof time takenbythe algorithmto solve the problemasfunctionof input
to the algorithm. The rate at whichfunctiongrowsasfunctionof input size iscalledGrowthof
Function.Itcan be constant,linear,quadratic,cubicetc.
Space Complexityreferstomemoryoccupiedorspace usedbyan algorithminthe mainmemory
withrespecttoinputsor as a functionof input to the algorithm.
We make use of AsymptoticNotationstocheckthe efficiencyof algorithm&we’ll alwaysprefer
algorithmwhichtakeslessmemory(i.e.,wastage isless) andterminatesinfinite time.
Soln 3.
ADT’srefersto AbstractionDataTypes. Basically, abstractionmeansprovidingthe relevant&
necessarydetailsbyhidingthe irrelevantdetails.
These are the Data types whichare createdby the user/programmer onitsownandare not present
instandard libraries. Itsspecificationdetailsare importantforusernotimplementationdetails.
While designingof ADT’stwothingsare important i.e., Specification&Implementation.
Specificationmeanswhatvaluesare presentinitsdomain&what operationscanbe performedon
valuesof that particulardatatype & Implementation referstohow these operationsare performed
and howthisdata type isrepresented.
2. User defineddatatypesare definedalongwiththeiroperations &to simplifythe processof solving
problems,we combine the datastructureswiththeiroperations &we call themAbstractData Types
(ADTs).
Soln 4.
Linear& Non-lineardatastructuresare classifiedunderNon-Primitive datastructures.
Linear Data Structure: It referstothe data structure whicharrangesor organise the dataitems or
elements inalinearfashionsothatall dataitemscan be traversedina single run.It neednotbe
linearorsequential inmemory.E.g. Arrays,Stacksetc.
Non-LinearData Structure: It referstothe data structure whicharrangesor organisesthe dataitems
or elementsinnon-linearorrandomfashion.Here,all dataitemscannotbe traversedina single run.
E.g Trees,graphsetc.
Soln 5.
Importance of Data Structures: Data Structure are logical or mathematical modelof particular
organisationof data.
1. Data structures organisesthe dataitemsina systematic& efficientmannersothattheycan
be accessedproperly/easilyandoperationsondataitemscan be carriedout effectively.
2. Data structuresorganisesthe dataitemsinsuch a way thatwastage of memorycan be
prevented&resultsinmore efficientprograms.