125
containedinsideotherregionswillalsogethigherpriorities,therightendpointofaninter-
valwillalwaysbefurthertotheleftthantherightendpointofanintervalthatcontainsit.
Withthispriorityfunction,theproblemcansolvedwithaslightlynon-standardapplication
ofaprioritysearchtree.
Prioritysearchtreessupportwhatareknownastwoandahalf-dimensionalqueries.A
prioritysearchtreestoringpairs(x, y),cansupportqueriesaskingforallpairswith
x
1 £ x £ x
2 andy £ y
1 ,wherex
1 ,x
2 ,andy
1 arearbitraryqueryvalues.They-dimensionofthe
prioritysearchtreedoesnotsupportfullygeneralrangequeries,butfortunatelythequeries
itdoessupportaresufficient.Werepresentasegment(s, e)withstartsandendeasapair
(e,s).Totestforasegmentwithrightendpointlessthanorequaltopthatoverlapsapoint
atv,searchforallstoredpairswithv £ x £ pandwithy £ v.Theconditiononxandven-
suresthattheresultintervalendsafterthequerypoint,andtheconditiononxandpen-
suresthattheintervalhasahigherprioritythanp.Theconditiononyandvensuresthat
theresultintervalstartsbeforev.
Thisstructureenablesthedeterminationofwhetheranaddressisdeletedbyamoveop-
erationwithpriorityhigherthanagivenvalue,inlogarithmictime.Twosmallsubtletiesare
worthnoting.Prioritysearchtreesrequirethatallendpointsonthex-axisbeuniqueinor-
dertomaintaintheruntimeguarantees.Thiscanbeensuredinthestandardwaybymaking
they-valueasecondarykeyalongthex-axis.Butthereisanadditionalneed,imposedby
theconstraintthatPalimpsestmustworkinfullydistributedenvironmentswithoutrequir-
ingglobalcommunication.Twomovesmaywellbecreatedatseparatesiteswiththesame
rightendpoints,buttheymuststillhaveuniquepriorities,incasetheyaremergedintothe
sameversion.Theuniquenessoftheseprioritiesmustbeensuredbyadditionalinformation
tosupplementthepriorityinformationgivenbytherightendpointofthemove’ssource
range.FortunatelytheuniqueIDsofchangescanbeusedtoaugmentthepositionalorderof
126
theirrightendpoints,sothatthefinalrepresentationofaninterval(x,y)intheprioritiy
searchtreeisatuple(Y,x),whereY = (y, x, ID).
6.7 Puttingitalltogether
Nowwewillexaminesomeofthealgorithmsfortheoperationslistedatthebeginningof
thissection.Inthepseudo-codeinthissection,theauxiliarydatastructuresareused,but
notdescribedinfulltokeepthefocusonthedetailsofwhatmustbeupdatedandqueried
when.Specializedstructuredforaddresscomparisonandmaintenanceoftheinsertionseg-
mentindexaredescribedinfull.
6.7.1 Addresscomparison
Wheneverachangeisaddedtothedatabase,theaddressesitcontainstoarestoredand
givenintegerlabels.Theselabelsareupdatedasnewaddressesareaddedtothedatabaseby
oneoftherenumberingalgorithmsgivenin(DietzandSleator1987),anddiscussedabove.
Palimpsestaddresscomparisoniscomplexandtheintegerlabelsservethefunctionofena-
blingconstant-timecomparisonofmanyaddresses,savingtimeonacommonoperation.
Addresseswithinmoveandcopydestinationsmayhavelongpaths.Inthedefinitionof
theorderingforPalimpsestaddresses,orderingquestionsarefrequentlyresolvedbyreducing
themtoquestionsonaddresseswithshorterpaths.Thesearegenerallynotstoredorlabeled,
astheyarenotusuallyreferencedbyotheroperations.Onlythoseaddressesarestoredthat
correspondtotheendpointsofranges(fordelete,copyandmove),ordestinations(forall
operations).
Tofindthecorrectpositioninthegloballistofstoredaddresses,acomparisonoperation
isneeded.Figure6.5showsthebasicmethodforastoredaddresstocompareitselftoan
arbitraryaddress.Notethatthedestinationaddressesofanychangesmustalreadyhave
beenstored,andarethusdirectlycomparablebymeansoflabels.Thefollowingauxiliary
methodsareusedinthecomparisonalgorithm:
Previous Page Next Page