6 b命令树一棵树有以下结构特性tree inverted file indexB树倒索引.pptx

6 b命令树一棵树有以下结构特性tree inverted file indexB树倒索引.pptx

§6B+Trees【Definition】AB+treeoforderMisatreewiththefollowingstructuralproperties:(1)Therootiseitheraleaforhasbetween2andMchildren.(2)Allnonleafnodes(excepttheroot)havebetween?M/2?andMchildren.(3)Allleavesareatthesamedepth.Assumeeachnonrootleafalsohasbetween?M/2?andMchildren.12152531415984911,4,8,1112,1315,18,1921,2425,2631,3841,43,4648,49,5059,6872,7884,8891,92B+treeoforder4(2-3-4tree)Alltheactualdataarestoredattheleaves.EachinteriornodecontainsMpointerstothechildren.AndM?1smallestkeyvaluesinthesubtreesexceptthe1stone.1/11

§6B+TreesAB+treeoforder3(2-3tree)8,11,1216,1722,23,3141,5258,59,6116:?41:5822:??Find:52?Insert:1816,17,18?Insert:1?11,1222,23,3141,5258,59,6111:1641:5822:?16,17,181,8?Insert:19?11,1222,23,3141,5258,59,6111:?41:5816:2216,171,818,1918:??Insert:282/11

§6B+Trees11,1222,2341,5258,59,6111:?58:?16:?16,171,818,1918:?28,3128:?22:?41:??Insert:70Firstfindasiblingwith2keysandadjust.Keepmorenodesfull.?Deletionissimilartoinsertionexceptthattherootisremovedwhenitlosestwochildren.3/11

§6B-TreesForageneralB-treeoforderMBtreeInsert(ElementTypeX,BtreeT){ SearchfromroottoleafforXandfindtheproperleafnode; InsertX; while(thisnodehasM+1keys){ splititinto2nodeswith?(M+1)/2?and?(M+1)/2?keys,respectively; if(thisnodeistheroot) createanewrootwithtwochildren; checkitsparent; }}Depth(M,N)=O(?log?M/2?N?)T=O(M)T(M,N)=O((M/logM)logN)TFind(M,N)=O(logN)Note:ThebestchoiceofMis3or4.Homework:p.1384.36Accessa2-3tree4/11

InvertedFileIndexHowcanIfindinwhichretrievedwebpagesthatincludeComputerScience?5/11

InvertedFileIndex?Solution1:ScaneachpageforthestringComputerScience.Waittillyournextlife!HowdidGoogledo?6/11

InvertedFileIndex?Solution2:InvertedFileIndex【Defi

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档