Research Article

An Efficient Algorithm for Maximizing Range Sum Queries in a Road Network

Algorithm 4

findMaxSegments( ).
Input : seg-file
Output maxSegs: list segments with maximum weight
(1)   Initialize an empty list maxSegs
(2)   maxWeight = 0
(3)   for each segRecord in seg-file do
(4)    localMaxSegs = lineSweep(segRecord)
(5)    localMaxWeight = localMaxSegs 0 .weight
(6)    if  (localMaxWeight ≥ maxWeight) then
(7)     if  (localMaxWeigh > maxWeight) then
(8)      maxWeight = localMaxWeight
(9)      maxSegs.clear()
(10)  end if
(11)  for each seg in localMaxSegs do
(12)    maxSegs.add(seg)
(14)  end for
(13) end if
(14) end for