Somereviewquestions
- Giventhe graph below, perform abreadth-firstsearch startingat vertex A. What doesthebreadth-firstspanning treelooklike?
- What isthedegreeofvertex Ainthisgraph?
- Whoaretheneighbours ofvertex Ainthisgraph?
- Arethevertices Band Eadjacentinthegraph?
- Givetheadjacency matrix representationofthegraph.
- Drawanadjacency listrepresentationofthegraph .
- Howmuch time doesittake tocheckifedge(u,v)isinthe graph ifyouuseanadjacency matrix representation?Ifyouuseanadjacency listrepresentation?
- What isanother nameforaconnected, acyclicgraph?
- Howmanyedgesdoesaconnected, acyclicgraph haveifithasnvertices?
- What isthe largest number ofedgesadirected graph canhaveifithasnvertices, noself- loopsandnoduplicate edges? What ifthegraph isundirected?
- Apply Kruskal’sand Prim’s algorithms to graph below
- Both Prim’s and Kruskal’s algorthms can be used to build a minimum cost spanning tree T. 0neofthese algorithms adds edgessuchthat Tisconnected at alltimes. Whichone?
- What isthedifferencebetweenabinary treeandabinary searchtree?
- Givesomepseudocode forthe recursive algorithms that perform the followingtraversalsofabinary tree
•pre-order traversal.
•in-order traversal.
•post-order traversal.
- Youperformapre-order traversalofabinary treeanditprints thefollowingvalues
AHCPKT.
What value wasat the root ofthe tree? Ifthe root has aleftchild, what value isstored there?
- Youperformanin-order traversalofabinary treewithrootR. Thevaluesprintedoutare
DKLCRTS.
What valuesareintheleftsubtree ofRandwhat valuesareintherightsubtree?
- When performing asearchforakeyx,youfirstcompare xagainst r,thenmovetotheleft subtree tocontinue yoursearch. The next comparison isbetween xand £,after whichyou movetotherightsubtree of£. What doyouknowabout therelation betweenthevaluesx, rand£?
- Thebinary treebelowcontained somevalueswhichweprintedoutusingapost-order traver- sal. The outputwas.JH DE QWP X. Wethen erased the values fromthe tree. Put them back.
- What isthemaximum height(depth)ofatreewithnnodes?
- What istheminimum height(depth)ofatreewithnnodes?
- What isa(binary max) heap? What areitsproperties?
- Canaheapcontain twokeyswiththesamevalue? Canabinarysearchtreecontain twokeys withthesamevalue?
- What isthe big0hrunning time forfindingthe third largest element ina(binary max) heap?
- What isthebig0hrunning timeforfindingthesmallest elementina(binary max)heap?
- Startingwith thebinary search tree below,showwhat the tree lookslikeafter performing
insert1,insert5,insert10,insert8,insTereret 4
5
29
7
- Performing asearch forthe number 1999inabinary search tree, youpasskeysnumbered 2400,6,1964,2300,2217.Atthispointisitpossibleforyoutoencounter thenumber 1700 intheremainder ofyoursearch?
- Howdoyoudeleteanodewithtwochildren fromabinary searchtree?
- Howdoyoufindthesmallest elementstored inabinary searchtree?
- What istheworst-case running timeofasearchinabinary searchtree?
- What isabalanced tree?
- What properties doAVLtreeshave?
- What istheworst-case running timeofasearchinanAVLtree?
- HowdoyouperformanLLrotationinanAVLtree? Whenissucharotationappropriate?
- Repeat question 71fortheRR,LR,andRLrotations
- When youinsert akeyxintoanAVLtree, and thiscausesthetreetobecomeunbalanced, onwhichnodedoyouperformarotation?
- For the hash function h(k) =k mod 53,what isthe range ofhash addresses that keyscanbesentto?
- What dowecallitwhentwonon-identicalkeysaresenttothesamehashaddress?
- Give two methods for resolving collisions in a hash table and state the advantagesand disadvantagesofboth.
- Therunning timeofasearchinahashtable ismostlydependentonwhat measure?
- Define greedy algorithm, dynamic programming, backtracking and clustering.