Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
<ul><li>Canonical interval decomposition </li></ul><ul><li>The “canonical interval decomposition” is a representation of t...
<ul><li>Trees for Sums of Weighted Intervals </li></ul><ul><li>An application of the canonical interval decomposition idea...
<ul><li>To construct the structure, we begin with the segment trees but instead of requiring to report all covering interv...
 
<ul><li>WE ARRIVE AT THE FOLLOWING STRUCTURE </li></ul><ul><li>A search tree on the interval endpoints or the places where...
Upcoming SlideShare
Loading in …5
×

Trees for sums of weighted intervals

872 views

Published on

Trees for sums of weighted intervals

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

Trees for sums of weighted intervals

  1. 1. <ul><li>Canonical interval decomposition </li></ul><ul><li>The “canonical interval decomposition” is a representation of the interval as union of disjoint node intervals. </li></ul><ul><li>Any search path for a value in the interval will go through exactly one node that belongs to the canonical interval decomposition. </li></ul>
  2. 2. <ul><li>Trees for Sums of Weighted Intervals </li></ul><ul><li>An application of the canonical interval decomposition idea is a structure that keeps track of a “piecewise constant function” represented as “sum of weighted intervals”. </li></ul><ul><li>We can identify an interval [a, b] with its indicator function, which is 1 for x ∈ [a, b] and 0 for x/∈ [a, b[; with this convention, we define weighted intervals </li></ul><ul><li>we can use the sum of weighted intervals, whose value at x is the sum of the weights of the intervals that contain x. </li></ul>
  3. 3. <ul><li>To construct the structure, we begin with the segment trees but instead of requiring to report all covering intervals we ask only for the number of covering intervals. </li></ul><ul><li>This way we do not need to keep in each tree node a list of the intervals, but just a single number. </li></ul><ul><li>For a query we just go down the search path and sum up all the numbers in nodes we have visited. </li></ul>
  4. 5. <ul><li>WE ARRIVE AT THE FOLLOWING STRUCTURE </li></ul><ul><li>A search tree on the interval endpoints or the places where the piecewise constant function jumps, with a number associated with each node. </li></ul><ul><li>The value of the function at a query key is the sum of the numbers associated with nodes on the search path for that key. </li></ul><ul><li>To increase the function on the interval [a, b[ by the value ‘w’ we find all nodes belonging to the canonical interval decomposition of [a, b] and increase their associated numbers by w. </li></ul><ul><li>If [a, b] were already keys of the underlying search tree, no further work is necessary during an insert; otherwise, we need to update the underlying search tree and adjust the numbers in the nodes in such a way that the sum along each path stays the same. </li></ul><ul><li>To delete an interval, we just insert it with negative weight and delete unnecessary leaves. </li></ul>

×