欢迎来到天天文库
浏览记录
ID:53733830
大小:346.76 KB
页数:11页
时间:2020-04-20
《计算机科学与导论第13章.pdf》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、CHAPTER13FileStructures(SolutionstoReviewQuestionsandProblems)ReviewQuestionsQ13-1.Thetwoaccessmethodsaresequentialandrandom.Q13-2.Theoldmasterfileisthefilethatshouldbeupdated;thenewmasterfilecon-tainsthecurrentdata(thedatafromtheoldmasterfileincludinganychange
2、sthatweremadeduringtheupdateprocess).Q13-3.Thetransactionfilecontainschangesthatshouldbemadetotheoldmasterfile.Q13-4.Toaccessarecordinafilerandomly,weneedtoknowtheaddressoftherecord.Q13-5.Theindexisatablethatrelatesthekeysofthedataitemstotheaddressesinthefilewh
3、erethedataarestored.Q13-6.Indirecthashing,thekeyistheaddressoftherecordinthefile.Q13-7.Inmodulodivisionhashing,thekeyisdividedbythefilesize.Theremainderplus1isusedastheaddressoftherecordinthefile.Q13-8.Indigitextractionhashing,certaindigitsareremovedfromthekeya
4、ndusedastheaddressoftherecord.Q13-9.Acollisionoccurswhentwohashedrecordhavethesameaddress.Thethreecollisionmethodsareopenaddressing,linkedlistresolution,andbuckethash-ing.Inopenaddressing,theprimeareaissearchedforanunoccupiedaddress.Inlinkedlistresolution,thefi
5、rstrecordisstoredinthehomeaddress,butitcontainsapointertothesecondrecord.Inbuckethashing,agroupofrecordsarestoredinabucketswhicharelocationsthatcanaccommodatemorethanonerecord.Q13-10.Atextfileisafileofcharacterswhileabinaryfileisacollectionofdatastoredintheinte
6、rnalformatofthecomputer.12ProblemsP13-1.Thefilesareshownbelow:NewMasterFileErrorFileKeyNamePayRateActionKeyNamePayRate14JohnWu17.00A17MarthaKent17.0016GeorgeBrown18.0017DucLee11.0026TedWhite23.0031JoanneKing28.0089MarkBlack19.0090OrvaGilbert20.0092BetsyYellow14
7、.00P13-2.Bothdatafileandindexfileareshownbelow.IndexDatafileKeyAddressAddressKeyNameDept.077654004000123453JohnAdamCIS093245003001114237TedWhiteMTH114237001002156734JimmyLionsENG123453000003093245SophieGrandsBUS156734002004077654EvePrimaryCIS256743005005256743E
8、vaLindensENG423458006006423458BobBauerECOP13-3.a.(14232mod41)+1=5+1=6b.(12560mod41)+1=14+1=15c.(13450mod41)+1=2+1=3d.(15341mod41)+1=7+1=8P13-4.a.1422=20164→16b.1252=15625→62
此文档下载收益归作者所有