Exercise5.1.1Asaset:speed2.662.101.422.803.202.202.001.863.06Average=2.37Asabag:speed2.662.101.422.803.203.202.202.202.002.801.862.803.06Average=2.48Exercise5.1.2Asaset:hd25080320200300160Average=218Asabag:hd2502508025025032020025025030016016080Average=215Exercise5.1.3aAsaset:bore15161418Asabag:bore1516141615151418Exercise5.1.3bbore(ShipsClasses)Exercise5.1.4aForbags:Ontheleft-handside:GivenbagsRandSwhereatupletappearsnandmtimesrespectively,theunionofbagsRandSwillhavetupletappearn+mtimes.ThefurtherunionofbagTwiththetupletappearingotimeswillhavetupletappearn+m+otimesinthefinalresult.Ontheright-handside:GivenbagsSandTwhereatupletappearsmandotimesrespectively,theunionofbagsRandSwillhavetupletappearm+otimes.ThefurtherunionofbagRwiththetupletappearingntimeswillhavetupletappearm+o+ntimesinthefinalresult.Forsets:Thisisasimilarcasewhendealingwithbagsexceptthetupletcanonlyappearatmostonceineachset.Thetupletonlyappearsintheresultifallthesetshavethetuplet.Otherwise,thetupletwillnotappearintheresult.Sincewecannothaveduplicates,theresultonlyhasatmostonecopyofthetuplet.Exercise5.1.4bForbags:Ontheleft-handside:GivenbagsRandSwhereatupletappearsnandmtimesrespectively,theintersectionofbagsRandSwillhavetupletappearmin(n,m)times.ThefurtherintersectionofbagTwiththetupletappearingotimeswillproducetupletmin(o,min(n,m))timesinthefinalresult.Ontheright-handside:GivenbagsSandTwhereatupletappearsmandotimesrespectively,theintersectionofbagsRandSwillhavetupletappearmin(m,o)times.ThefurtherintersectionofbagRwiththetupletappearingntimeswillproducetupletmin(n,min(m,o))timesinthefinalresult.TheintersectionofbagsR,SandTwillyieldaresultwheretupletappearsmin(n,m,o)times.Forsets:Thisisasimilarcasewhendealingwithbagsexceptthetupletcanonlyappearatmostonceineachset.Thetupletonlyappearsintheresultifallthesetshavethetuplet.Otherwise,thetupletwillnotappearintheresult.Exercise5.1.4cForbags:Ontheleft-handside:GiventhattuplerinR,whichappearsmtimes,cansuccessfullyjoinwithtuplesinS,whichappearsntimes,weexpecttheresulttocontainmncopies.AlsogiventhattupletinT,whichappearsotimes,cansuccessfullyjoinwiththejoinedtuplesofrands,weexpectthefinalresulttohavemnocopies.Ontheright-handside:GiventhattuplesinS,whichappearsntimes,cansuccessfullyjoinwithtupletinT,whichappearsotimes,weexpecttheresulttocontainnocopies.AlsogiventhattuplerinR,whichappearsmtimes,cansuccessfullyjoinwiththejoinedtuplesofsandt,weexpectthefinalresulttohavenomcopies.Theorderinwhichweperformthenaturaljoindoesnotmatterforbags.Forsets:Thisisasimilarcasewhendealingwithbagsexceptthejoinedtuplescanonlyappearatmostonceineachresult.Iftherearetuplesr,s,tinrelationsR,S,Tthatcansuccessfullyjoin,thentheresultwillcontainatuplewiththeschemaoftheirjoinedattributes.Exercise5.1.4dForbags:SupposeatupletoccursnandmtimesinbagsRandSrespectively.IntheunionofthesetwobagsRS,tupletwouldappearn+mtimes.Likewise,intheunionofthesetwobagsSR,tupletwouldappearm+ntimes.Bothsidesoftherelationyieldthesameresult.Forsets:Atupletcanonlyappearatmostonetime.TupletmightappeareachinsetsRandSoneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupletappearsinbothsetsRandSwilltheunionRShavethetuplet.ThesamereasoningholdswhenwetaketheunionSR.Thereforethecommutativelawforunionholds.Exercise5.1.4eForbags:SupposeatupletoccursnandmtimesinbagsRandSrespectively.IntheintersectionofthesetwobagsRS,tupletwouldappearmin(n,m)times.LikewiseintheintersectionofthesetwobagsSR,tupletwouldappearmin(m,n)times.Bothsidesoftherelationyieldthesameresult.Forsets:Atupletcanonlyappearatmostonetime.TupletmightappeareachinsetsRandSoneorzerotimes.ThecombinationsofnumberofoccurrencesfortupletinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupletappearsinatleastoneofthesetsRandSwilltheintersectionRShavethetuplet.ThesamereasoningholdswhenwetaketheintersectionSR.Thereforethecommutativelawforintersectionholds.Exercise5.1.4fForbags:SupposeatupletoccursntimesinbagRandtupleuoccursmtimesinbagS.Supposealsothatthetwotuplest,ucansuccessfullyjoin.TheninthenaturaljoinofthesetwobagsRS,thejoinedtuplewouldappearnmtimes.LikewiseinthenaturaljoinofthesetwobagsSR,thejoinedtuplewouldappearmntimes.Bothsidesoftherelationyieldthesameresult.Forsets:Anarbitrarytupletcanonlyappearatmostonetimeinanyset.Tuplesu,vmightappearrespectivelyinsetsRandSoneorzerotimes.Thecombinationsofnumberofoccurrencesfortuplesu,vinRandSrespectivelyare(0,0),(0,1),(1,0),and(1,1).OnlywhentupleuexistsinRandtuplevexistsinSwillthenaturaljoinRShavethejoinedtuple.ThesamereasoningholdswhenwetakethenaturaljoinSR.Thereforethecommutativelawfornaturaljoinholds.Exercise5.1.4gForbags:SupposetupletappearsmtimesinRandntimesinS.IfwetaketheunionofRandSfirst,wewillgetarelationwheretupletappearsm+ntimes.TakingtheprojectionofalistofattributesLwillyieldaresultingrelationwheretheprojectedattributesfromtupletappearm+ntimes.IfwetaketheprojectionoftheattributesinlistLfirst,thentheprojectedattributesfromtupletwouldappearmtimesfromRandntimesfromS.Theunionoftheseresultingrelati