Professional Documents
Culture Documents
MYPROFILE SolutionReportForAlgorithms
Representwholetestsolutionwithcorrectandincorrectanswers.
REPORTS
ViewYourTestAnalysis
BUYPACKAGE
NEWS
Q.No QuestionStatus
AskanExpert
Q.1 WhatistheworstcasetimecomplexitytosortonarrayA[0ton]wheretheelementsatindexA[2i](atevenarrayindex)
isinitscorrectposition?
a.(n2 )
b. (nlogn)
c.(n)
d.Noneofthese
Q.2 What is the worst case time complexity to sort n elements by first constructing a Binary Search Tree on those n
elementsfollowedbyaninordertraversalonthetree?
a. (n2 )
b.(nlogn)
c.(n2 logn)
d.(n)
Q.3 WhatistheworstcasetimecomplexitytoconstructanAVLtreefromanarraywhichsatisfiestheminheapproperty?
a. (nlogn)
b.(n2 )
c.(n2 logn)
d.(n)
Q.4 WhichofthefollowingprocedureresultssameoutputasDijkstrasalgorithmonunweightedgraphwithnvertices?
a. Breadthfirstsearch
b.Depthfirstsearch
c.Kruskalalgorithm
d.Primsalgorithm
Q.5 Considerthefollowingfunction.
Whatistheworstcaserunningtimeofthefunctionfforanypositivevalueofn?
a.(1)
b.(n)
c. (n2 )
d.(n3 )
https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 1/6
2/13/2017 MADEEASYONLINETESTSERIES
Q.6 WhatisthetimecomplexityofHuffmancodingusingheaptreedatastructure?
a.(n)
b.(logn)
c. (nlogn)
d.(n2 )
Q.7 ConsiderthefollowingknapsackproblemwithcapacityW=8
Whichofthefollowingitemisnotselectedintheoptimalsolutionof0/1Knapsackproblem?
a.I1 only
b. I2 only
c.I3 only
d.Noneofthese
Q.8 What is worst case time complexity to find all the nodes at height v /2 from a particular node in a graph having v
verticesandeedges?
a.(v2 )
b.(vloge)
c. (v+e)
d.(v2 loge)
Q.9 Whichofthefollowingistrue?
a.Ifatopologicalsortexistsfortheverticesinadirectedgraph,thenDFSonthegraphwillproducenobackedges.
b.TraversingDFSalgorithmonadirectedgraphG.IfweremovedallbackedgesfromgraphG,thenresultinggraphisacyclic
graph.
c. Both(a)and(b)
d.Noneofthese
Q.10 Whichofthefollowingistrue?
a.TherunningtimeofRadixSortiseffectivelyindependentofwhethertheinputisalreadysorted.
b.ChangingtheRELAXfunctiontoupdateisd[v]d[u]+w(u,v)(insteadofstrictlygreaterthan)willproduceshortestpath,but
willnoteffectthecorrectnessofBellmanFordalgorithmsoutputs.
c. Both(a)and(b)
d.Noneofthese
Q.11 The maximum number of nodes in Binary Search Tree of height h which have same inorder and preorder will be
__________(assumeh=10androotisatheight0)
Q.12 Considerthefollowingsortingalgorithm
Sorting(A,low,high)
https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 2/6
2/13/2017 MADEEASYONLINETESTSERIES
Therunningtimeofsorting(A,1,n)functionis(nx ).Thevalueofx+3is__________[Usevalueofxupto1decimal
places]
Q.13 ConsiderthefollowinggraphG.
ThetotalnumberofminimumspanningtreesfromgraphGare______.
Q.14 Considerthefollowingtable
Thenumberofbitsthatareneededtoencodeastringcontaining14as,3bs,6csand10dsusingthehuffmancoding
are___________.
Q.15 Assume there is an algorithm which take (log2 log2 n) time to sort n elements algorithm, person one will takes 22
secondstoexecuteonsomedataofsizeY. Person to will take 33 seconds for data size of 256. The data size of Y is
__________.
Q.16 Considertheweightedundirectedgraphbelow
AssumethatedgeBF is added to the minimum spanning tree. The maximum value of BF so that this new edge can
belongtotheminimumspanningtreeis_________.
Q.17
Considerwehaveanalgorithmwhichgeneratepreorderofanytreein(n2 )time,wehavetocreateaBinarySearchTree
withndistinctelement.Whichofthefollowingwillrepresentstheworstcasetimecomplexity?
a.(n)
b.(nlogn)
c. (n2 )
https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 3/6
2/13/2017 MADEEASYONLINETESTSERIES
d.(1)
Q.18 Letf(n)=(n),g(n)=(n)andh(n)=(n).Theng(n)+f(n).h(n)is______
a. (n)
b.(n2 )
c.(n2 )
d.(n)
Q.19 Considerthegraphgivenbelow:
SupposeyouarerunningDijkstrasalgorithmstartingfromsourcevertexD.Whatwillbetheorderofverticeswhichwill
berelaxedusingDijkastrasalgorithm?
a. DFBHEGCA
b.DFBHGECA
c.DFBHEGAC
d.DFBEHGCA
Q.20 Considerthefollowingadjacencymatrix
Whichofthefollowingistransitiveclosureofthedirectedgraphdefinedbytheaboveadjacencymatrix?
a.
b.
c.
d.
Q.21 MatchListI(Dynamicalgorithm)withListII(Averagecaserunningtime)andselectthecorrectanswerusingthecodes
givenbelowthelists:
ListI(Dynamicalgorithm) ListII(Averagecaserunningtime)
A.Matrixchainmultiplication 1.(mn)
B.Travellingsalesmanproblem 2.(n3 )
C.0/1knapsack 3.(nn)
D.Fibonacciseries 4.(n)
Codes:
A B C D
(a) 1 3 2 4
(b) 1 3 3 2
https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 4/6
2/13/2017 MADEEASYONLINETESTSERIES
(c) 2 3 3 2
(d) 2 3 1 4
a.a
b.b
c.c
d. d
Q.22 ConsidertwoverticesaandbthataresimultaneouslyontheFIFOqueueatsamepointduringtheexecutionofbreadth
firstsearchfromsinanundirectedgraph.Considerthefollowingstatements:
S1 :Thenumberofedgesontheshortestpathbetweensandaisatmostonemorethanthenumberof
edgesontheshortestpathbetweensandb.
S2 :Thenumberofedgesontheshortestpathbetweensandaisatleastonelessthanthenumberof
edgesontheshortestpathbetweensandb.
S3 :Thereisaedgebetweenaandb.
Whichofthefollowingistrue?
Q.23 LetG(V,E)beanundirectedgraphwithpositiveedgeweights.Whatistheworstcasetimecomplexitytofindminimum
spanningtreeusingKruskalalgorithmisimplementedusingarraydatastructure?
a.(|E|+|V|log|V|)
b. (|V|log|V|)
c.(|V|2 )
d.(|V|log2 |V|)
Q.24 Acertainproblemishavinganalgorithmwiththefollowingrecurrencerelation.
Howmuchtimewouldthealgorithmtaketosolvetheproblem?
a.
b.
c.
d.
Q.25 Considerthefollowingstatements
I.LetTbeaminimumspanningtreeofagraphG.Thenforanytwoverticesuandvthepathfromuto
vinTistheshortestpathfromutovinthegraphG.
II.SupposethataverageedgeweightforagraphGisAavg.ThentheminimumspanningtreeofGwill
haveweightatmost(n1)Aavg,wherenisnumberofverticesingraphG.
Whichoftheabovestatementsaretrue?
a.OnlyI
b.OnlyII
c.BothIandII
d. Noneofthese
Q.26 LetAisaMaxHeapwithheapsizelogn.AfunctionMHY(A,i,key)thatreplacesA[i]withagivenvaluekeyanditwill
adjustsothatresultbecomeMaxHeap.WhatistheworstcasetimecomplexitytoperformMHY(A,i,key)?
a. (loglogn)
b.(n)
c.(1)
d.(nlogn)
https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 5/6
2/13/2017 MADEEASYONLINETESTSERIES
NotAttempt CorrectAns. a VideoSolution FAQ? Haveanydoubt? Solution
Q.27 Considerthefollowingstatements:
S1 :Givenaminheapofheightlogn,itwilltake(logn)timetodeletetherootelementoftheheap.
S2 :TimecomplexityoffractionalKnapsackusinggreedyalgorithmis(n2 ).
S3 :Selectionsortworksongreedyapproach.
Whichofthefollowingoptioniscorrect
Q.28 Consider a procedure find ( ) which take array of n integers as input and produce pair of elements of array whose
differenceisnotgreaterthanthedifferenceofanyotherpairofelementofthatarray.Whichofthefollowingrepresent
worstcasetimecomplexityoffind()procedure?
a.(n)
b. (nlogn)
c.(n2 )
d.(n2 logn)
Q.29 Considerthehashingtablewithmslotsandnkeys.Iftheexpectednumberofprobesinunsuccessfulsearchis3.The
expectednumberofprobesinasuccessfulsearchis_______(upto2decimalplace).
Q.30 AssumethatanuppertriangularmatrixA[0...99,0...99]isstoredinalineararrayCofsize5050withrowmajororder.If
A[0,0]isstoredinC[0],findtheindexofCwhereA[70,90]isstoredinit.
Q.31 Considerthefollowingstatementswithrespecttoquicksort.
S1 :Whileperformingsortingatanyiterationonly1elementcanbepresentatitscorrectposition.
S2 :Atfirstiteration,noneoftheelementchangesitsposition,iffgiveninputisalreadysorted.
S3 :Afterithiterationappliedonthesetofelementsleftafter(i1)iterations,ifanyelementisfoundtobe
atitscorrectposition,thenthatelementmusthavebeenthepivotfortheithiteration.
Thenumberofstatementsthataretrue__________.
Q.32 Themaximumnumberofordersinwhichwecaninsertelement{1,2,.....,7}intoanemptyAVLbinarytreesothatno
rotationneedtobeperformedonitare__________(Considerkeyofrootnodeis4always).
Q.33 A min heap having 1024 distinct elements with keys ranging from 0 to 1023 is stored in array of 1024 indices. The
maximum difference between the keys of all the element that can possibly be stored at index of the array is
__________.
https://onlinetestseriesmadeeasy.in/madeeasy/index.php?pageName=timeManagementReport&testid=1221&t=cont1&testType=2 6/6