Você está na página 1de 13

4/30/2015

Top50DataStructureInterviewQuestions

Top 50 Data Structure Interview


Questions
DownloadPDF[/top50datastructureinterview
questions/?format=pdf]

[http://jobs.guru99.com/en_Jobseekers.html?
utm_source=career.guru99&utm_medium=referral&utm_campaign=click]
1)Whatisdatastructure?
Datastructurereferstothewaydataisorganizedand
manipulated.Itseekstofindwaystomakedataaccess
moreefficient.Whendealingwithdatastructure,wenot
onlyfocusononepieceofdata,butratherdifferentsetof
dataandhowtheycanrelatetooneanotherinan
organizedmanner.
2)Differentiatefilestructurefromstoragestructure.
Basically,thekeydifferenceisthememoryareathatis
beingaccessed.Whendealingwiththestructurethat
residesthemainmemoryofthecomputersystem,thisis
referredtoasstoragestructure.Whendealingwithan
http://career.guru99.com/top50datastructureinterviewquestions/

1/13

4/30/2015

Top50DataStructureInterviewQuestions

referredtoasstoragestructure.Whendealingwithan
auxiliarystructure,werefertoitasfilestructure.
3)Whenisabinarysearchbestapplied?
Abinarysearchisanalgorithmthatisbestappliedto
searchalistwhentheelementsarealreadyinorderor
sorted.Thelistissearchstartinginthemiddle,suchthatif
thatmiddlevalueisnotthetargetsearchkey,itwillcheck
toseeifitwillcontinuethesearchonthelowerhalfofthe
listorthehigherhalf.Thesplitandsearchwillthen
continueinthesamemanner.
4)Whatisalinkedlist?
Alinkedlistisasequenceofnodesinwhicheachnodeis
connectedtothenodefollowingit.Thisformsachainlike
linkofdatastorage.
5)Howdoyoureferencealltheelementsinaone
dimensionarray?
Todothis,anindexedloopisused,suchthatthecounter
runsfrom0tothearraysizeminusone.Inthismanner,we
areabletoreferencealltheelementsinsequencebyusing
theloopcounterasthearraysubscript.
6)Inwhatareasdodatastructuresapplied?
Datastructureisimportantinalmosteveryaspectwhere
dataisinvolved.Ingeneral,algorithmsthatinvolveefficient
datastructureisappliedinthefollowingareas:numerical
analysis,operatingsystem,A.I.,compilerdesign,database
management,graphics,andstatisticalanalysis,tonamea
few.
7)WhatisLIFO?
LIFOisshortforLastInFirstOut,andreferstohowdata
isaccessed,storedandretrieved.Usingthisscheme,data
thatwasstoredlast,shouldbetheonetobeextracted
first.Thisalsomeansthatinordertogainaccesstothe
firstdata,alltheotherdatathatwasstoredbeforethisfirst
http://career.guru99.com/top50datastructureinterviewquestions/

2/13

4/30/2015

Top50DataStructureInterviewQuestions

datamustfirstberetrievedandextracted.
8)Whatisaqueue?
Aqueueisadatastructurethatcansimulatesalistor
streamofdata.Inthisstructure,newelementsareinserted
atoneendandexistingelementsareremovedfromthe
otherend.
9)Whatarebinarytrees?

[http://cdn.career.guru99.com/wp
content/uploads/2012/05/binarytree.png]
Abinarytreeisonetypeofdatastructurethathastwo
nodes,aleftnodeandarightnode.Inprogramming,binary
treesareactuallyanextensionofthelinkedliststructures.
10)Whichdatastructureisappliedwhendealingwith
arecursivefunction?
Recursion,whichisbasicallyafunctionthatcallsitself
basedonaterminatingcondition,makesuseofthestack.
UsingLIFO,acalltoarecursivefunctionsavesthereturn
addresssothatitknowshowtoreturntothecalling
functionafterthecallterminates.
11)Whatisastack?
http://career.guru99.com/top50datastructureinterviewquestions/

3/13

4/30/2015

Top50DataStructureInterviewQuestions

Astackisadatastructureinwhichonlythetopelement
canbeaccessed.Asdataisstoredinthestack,eachdata
ispusheddownward,leavingthemostrecentlyaddeddata
ontop.
12)ExplainBinarySearchTree
Abinarysearchtreestoresdatainsuchawaythatthey
canberetrievedveryefficiently.Theleftsubtreecontains
nodeswhosekeysarelessthanthenodeskeyvalue,
whiletherightsubtreecontainsnodeswhosekeysare
greaterthanorequaltothenodeskeyvalue.Moreover,
bothsubtreesarealsobinarysearchtrees.
13)Whataremultidimensionalarrays?
Multidimensionalarraysmakeuseofmultipleindexesto
storedata.Itisusefulwhenstoringdatathatcannotbe
representedusingasingledimensionalindexing,suchas
datarepresentationinaboardgame,tableswithdata
storedinmorethanonecolumn.
14)Arelinkedlistsconsideredlinearornonlineardata
structure?
Itactuallydependsonwhereyouintendtoapplylinked
lists.Ifyoubaseditonstorage,alinkedlistisconsidered
nonlinear.Ontheotherhand,ifyoubaseditonaccess
strategies,thenalinkedlistisconsideredlinear.
15)Howdoesdynamicmemoryallocationhelpin
managingdata?
Asidefrombeingabletostoresimplestructureddata
types,dynamicmemoryallocationcancombineseparately
allocatedstructuredblockstoformcompositestructures
thatexpandandcontractasneeded.
16)WhatisFIFO?
FIFOisshortforFirstin,Firstout,andisusedto
representhowdataisaccessedinaqueue.Datahasbeen
insertedintothequeuelistthelongestistheonethatis
http://career.guru99.com/top50datastructureinterviewquestions/

4/13

4/30/2015

Top50DataStructureInterviewQuestions

insertedintothequeuelistthelongestistheonethatis
removedfirst.
17)Whatisanorderedlist?

Anorderedlistisalistinwhicheachnodespositioninthe
listisdeterminedbythevalueofitskeycomponent,so
thatthekeyvaluesformanincreasingsequence,asthe
lististraversed.
18)Whatismergesort?
Mergesorttakesadivideandconquerapproachtosorting
data.Inasequenceofdata,adjacentonesaremergedand
sortedtocreatebiggersortedlists.Thesesortedlistsare
thenmergedagaintoformanevenbiggersortedlist,which
continuousuntilyouhaveonesinglesortedlist.
19)DifferentiateNULLandVOID.
Nullisactuallyavalue,whereasVoidisadatatype
identifier.AvariablethatisgivenaNullvaluesimply
indicatesanemptyvalue.Voidisusedtoidentifypointers
ashavingnoinitialsize.
20)Whatistheprimaryadvantageofalinkedlist?
Alinkedlistisaveryidealdatastructurebecauseitcanbe
modifiedeasily.Thismeansthatmodifyingalinkedlist
worksregardlessofhowmanyelementsareinthelist.
21)WhatisthedifferencebetweenaPUSHanda
POP?
Pushingandpoppingappliestothewaydataisstoredand
retrievedinastack.Apushdenotesdatabeingaddedtoit,
meaningdataisbeingpushedintothestack.Onthe
otherhand,apopdenotesdataretrieval,andinparticular
referstothetopmostdatabeingaccessed.
22)Whatisalinearsearch?
Alinearsearchreferstothewayatargetkeyisbeing
searchedinasequentialdatastructure.Usingthismethod,
eachelementinthelistischeckedandcomparedagainst

http://career.guru99.com/top50datastructureinterviewquestions/

5/13

4/30/2015

Top50DataStructureInterviewQuestions

eachelementinthelistischeckedandcomparedagainst
thetargetkey,andisrepeateduntilfoundoriftheendof
thelisthasbeenreached.
23)Howdoesvariabledeclarationaffectmemory
allocation?
Theamountofmemorytobeallocatedorreservedwould

dependonthedatatypeofthevariablebeingdeclared.For
example,ifavariableisdeclaredtobeofintegertype,then
32bitsofmemorystoragewillbereservedforthat
variable.
24)Whatistheadvantageoftheheapoverastack?
Basically,theheapismoreflexiblethanthestack.Thats
becausememoryspacefortheheapcanbedynamically
allocatedanddeallocatedasneeded.However,memory
oftheheapcanattimesbeslowerwhencomparedtothat
stack.
25)Whatisapostfixexpression?

[http://jobs.guru99.com/en_Jobseekers.html?
utm_source=career.guru99&utm_medium=referral&utm_campaign=click]
Apostfixexpressionisanexpressioninwhicheach
operatorfollowsitsoperands.Theadvantageofthisform
isthatthereisnoneedtogroupsubexpressionsin
parenthesesortoconsideroperatorprecedence.
26)WhatisDataabstraction?
http://career.guru99.com/top50datastructureinterviewquestions/

6/13

4/30/2015

26)WhatisDataabstraction?

Top50DataStructureInterviewQuestions

Dataabstractionisapowerfultoolforbreakingdown
complexdataproblemsintomanageablechunks.Thisis
appliedbyinitiallyspecifyingthedataobjectsinvolvedand
theoperationstobeperformedonthesedataobjects
withoutbeingoverlyconcernedwithhowthedataobjects
willberepresentedandstoredinmemory.
27)Howdoyouinsertanewiteminabinarysearch
tree?
Assumingthatthedatatobeinsertedisauniquevalue
(thatis,notanexistingentryinthetree),checkfirstifthe
treeisempty.Ifitsempty,justinsertthenewiteminthe
rootnode.Ifitsnotempty,refertothenewitemskey.If
itssmallerthantherootskey,insertitintotherootsleft
subtree,otherwise,insertitintotherootsrightsubtree.
28)Howdoesaselectionsortworkforanarray?
Theselectionsortisafairlyintuitivesortingalgorithm,,
thoughnotnecessarilyefficient.Toperformthis,the
smallestelementisfirstlocatedandswitchedwiththe
elementatsubscriptzero,therebyplacingthesmallest
elementinthefirstposition.Thesmallestelement
remaininginthesubarrayisthenlocatednextwith
subscripts1throughn1andswitchedwiththeelementat
subscript1,therebyplacingthesecondsmallestelement
inthesecondposition.Thestepsarerepeatedinthesame
mannertillthelastelement.
29)Howdosignedandunsignednumbersaffect
memory?
Inthecaseofsignednumbers,thefirstbitisusedto
indicatewhetherpositiveornegative,whichleavesyou
withonebitshort.Withunsignednumbers,youhaveall
bitsavailableforthatnumber.Theeffectisbestseeninthe
numberrange(unsigned8bitnumberhasarange0255,
while8bitsignednumberhasarange128to+127.
30)Whatistheminimumnumberofnodesthata
http://career.guru99.com/top50datastructureinterviewquestions/

7/13

4/30/2015

Top50DataStructureInterviewQuestions

30)Whatistheminimumnumberofnodesthata
binarytreecanhave?

Abinarytreecanhaveaminimumofzeronodes,which
occurswhenthenodeshaveNULLvalues.Furthermore,a
binarytreecanalsohave1or2nodes.
31)Whataredynamicdatastructures?
Dynamicdatastructuresarestructuresthatexpandand
contractasaprogramruns.Itprovidesaflexiblemeansof
manipulatingdatabecauseitcanadjustaccordingtothe
sizeofthedata.
32)Inwhatdatastructuresarepointersapplied?
Pointersthatareusedinlinkedlisthavevarious
applicationsindatastructure.Datastructuresthatmake
useofthisconceptincludetheStack,Queue,LinkedList
andBinaryTree.
33)Doalldeclarationstatementsresultinafixed
reservationinmemory?
Mostdeclarationsdo,withtheexemptionofpointers.
Pointerdeclarationdoesnotallocatememoryfordata,but
fortheaddressofthepointervariable.Actualmemory
allocationforthedatacomesduringruntime.
34)WhatareARRAYs?
Whendealingwitharrays,dataisstoredandretrieved
usinganindexthatactuallyreferstotheelementnumberin
thedatasequence.Thismeansthatdatacanbeaccessed
inanyorder.Inprogramming,anarrayisdeclaredasa
variablehavinganumberofindexedelements.
35)Whatistheminimumnumberofqueuesneeded
whenimplementingapriorityqueue?
Theminimumnumberofqueuesneededinthiscaseis
two.Onequeueisintendedforsortingprioritieswhilethe
otherqueueisintendedforactualstorageofdata.
36)Whichsortingalgorithmisconsideredthefastest?

http://career.guru99.com/top50datastructureinterviewquestions/

8/13

4/30/2015

Top50DataStructureInterviewQuestions

36)Whichsortingalgorithmisconsideredthefastest?
Therearemanytypesofsortingalgorithms:quicksort,
bubblesort,balloonsort,radixsort,mergesort,etc.Not

onecanbeconsideredthefastestbecauseeachalgorithm
isdesignedforaparticulardatastructureanddataset.It
woulddependonthedatasetthatyouwouldwanttosort.
37)DifferentiateSTACKfromARRAY.
DatathatisstoredinastackfollowsaLIFOpattern.This
meansthatdataaccessfollowsasequencewhereinthe
lastdatatobestoredwillthefirstonetobeextracted.
Arrays,ontheotherhand,doesnotfollowaparticular
orderandinsteadcanbeaccessedbyreferringtothe
indexedelementwithinthearray.
38)Giveabasicalgorithmforsearchingabinary
searchtree.
1.ifthetreeisempty,thenthetargetisnotinthetree,end
search
2.ifthetreeisnotempty,thetargetisinthetree
3.checkifthetargetisintherootitem
4.iftargetisnotintherootitem,checkiftargetissmaller
thantherootsvalue
5.iftargetissmallerthantherootsvalue,searchtheleft
subtree
6.else,searchtherightsubtree
39)Whatisadequeue?
Adequeueisadoubleendedqueue.Thisisastructure
whereinelementscanbeinsertedorremovedfromeither
end.
40)Whatisabubblesortandhowdoyouperformit?
Abubblesortisonesortingtechniquethatcanbeapplied
todatastructuressuchasanarray.Itworksbycomparing
adjacentelementsandexchangestheirvaluesiftheyare
outoforder.Thismethodletsthesmallervaluesbubble
tothetopofthelist,whilethelargervaluesinkstothe
http://career.guru99.com/top50datastructureinterviewquestions/

9/13

4/30/2015

Top50DataStructureInterviewQuestions

bottom.
41)Whatarethepartsofalinkedlist?
Alinkedlisttypicallyhastwoparts:theheadandthetail.
Betweentheheadandtaillietheactualnodes,witheach
nodebeinglinkedinasequentialmanner.
42)Howdoesselectionsortwork?
Selectionsortworksbypickingthesmallestnumberfrom
thelistandplacingitatthefront.Thisprocessisrepeated
forthesecondpositiontowardstheendofthelist.Itisthe
simplestsortalgorithm.
43)Whatisagraph?
Agraphisonetypeofdatastructurethatcontainsasetof
orderedpairs.Theseorderedpairsarealsoreferredtoas
edgesorarcs,andareusedtoconnectnodeswheredata
canbestoredandretrieved.
44)Differentiatelinearfromnonlineardatastructure.
Lineardatastructureisastructurewhereindataelements
areadjacenttoeachother.Examplesoflineardata
structureincludearrays,linkedlists,stacksandqueues.
Ontheotherhand,nonlineardatastructureisastructure
whereineachdataelementcanconnecttomorethantwo
adjacentdataelements.Examplesofnonlineardata
structureincludetreesandgraphs.
45)WhatisanAVLtree?
AnAVLtreeisatypeofbinarysearchtreethatisalways
inastateofpartiallybalanced.Thebalanceismeasured
asadifferencebetweentheheightsofthesubtreesfrom
theroot.Thisselfbalancingtreewasknowntobethefirst
datastructuretobedesignedassuch.
46)Whataredoublylinkedlists?
Doublylinkedlistsareaspecialtypeoflinkedlistwherein
traversalacrossthedataelementscanbedoneinboth
http://career.guru99.com/top50datastructureinterviewquestions/

10/13

4/30/2015

Top50DataStructureInterviewQuestions

traversalacrossthedataelementscanbedoneinboth
directions.Thisismadepossiblebyhavingtwolinksin

everynode,onethatlinkstothenextnodeandotherone
thatlinkstothepreviousnode.
47)WhatisHuffmansalgorithm?
Huffmansalgorithmisassociatedincreatingextended
binarytreesthathasminimumweightedpathlengthsfrom
thegivenweights.Itmakesuseofatablethatcontains
frequencyofoccurrenceforeachdataelement.
48)WhatisFibonaccisearch?
Fibonaccisearchisasearchalgorithmthatappliestoa
sortedarray.Itmakesuseofadivideandconquer
approachthatcangreatlyreducethetimeneededinorder
toreachthetargetelement.
49)Brieflyexplainrecursivealgorithm.
Recursivealgorithmtargetsaproblembydividingitinto
smaller,manageablesubproblems.Theoutputofone
recursionafterprocessingonesubproblembecomesthe
inputtothenextrecursiveprocess.
50)Howdoyousearchforatargetkeyinalinkedlist?
Tofindthetargetkeyinalinkedlist,youhavetoapply
sequentialsearch.Eachnodeistraversedandcompared
withthetargetkey,andifitisdifferent,thenitfollowsthe
linktothenextnode.Thistraversalcontinuesuntileither
thetargetkeyisfoundorifthelastnodeisreached.

Data Structure

Start

http://career.guru99.com/top50datastructureinterviewquestions/

11/13

4/30/2015

Top50DataStructureInterviewQuestions

[http://jobs.guru99.com/en_Jobseekers.html?
utm_source=career.guru99&utm_medium=referral&utm_campaign=click]

Related Posts:
Top18Algorithm

Top100CInterview

InterviewQuestions

Questions&Answers

[http://career.guru99.com/top
[http://career.guru99.com/top
18algorithm

100cinterview

interviewquestions/]

questionsanswers/]

[http://career.guru99.com/top
18algorithminterview
Top50COBOL
InterviewQuestions&

Top20Neo4j

Answers

InterviewQuestions

[http://career.guru99.com/top
[http://career.guru99.com/top
50cobolinterview

20ne04jinterview

questionsanswers/]

questions/]

Share this entry

WHAT'STHIS?

ALSOONCAREERGURU99

Top50C#Interview
Questions&Answers

Top50Datawarehousing
Questions&Answers

3comments

1comment

35GooglesTrickyInterview
Questions1comment

Comments

Top50StrutsInterview
Questions3comments

Community

http://career.guru99.com/top50datastructureinterviewquestions/

Login
12/13

4/30/2015

Comments

Community

Top50DataStructureInterviewQuestions

Recommend

Login

SortbyBest

Startthediscussion

Bethefirsttocomment.

Subscribe

CopyrightCareerGuru992015

http://career.guru99.com/top50datastructureinterviewquestions/

13/13

Você também pode gostar