|
|
Line 1: |
Line 1: |
|
{{task}} |
|
{{task}} |
|
|
|
|
|
Define a range of numbers <code>R</code>, with bounds <code>b0</code> and <code>b1</code> covering all numbers ''between and including both bounds''. That range can be shown as:<br> |
|
Define a range of numbers '''R''', with bounds '''b0''' and '''b1''' covering all numbers ''between and including both bounds''. |
|
|
|
|
: <code>[b0, b1]</code><br> |
|
|
|
|
|
or equally as:<br> |
|
|
|
That range can be shown as: |
|
: <code>[b1, b0]</code>. |
|
|
|
::::::::: '''[b0, b1]''' |
|
|
:::::::: or equally as: |
|
|
::::::::: '''[b1, b0]''' |
|
|
|
|
|
|
|
|
Given two ranges, the act of consolidation between them compares the two ranges: |
|
Given two ranges, the act of consolidation between them compares the two ranges: |
|
* If one range covers all of the other then the result is that encompassing range. |
|
* If one range covers all of the other then the result is that encompassing range. |
|
* If the ranges touch or intersect then the result is ''one'' new single range covering the overlapping ranges. |
|
* If the ranges touch or intersect then the result is ''one'' new single range covering the overlapping ranges. |
|
* Otherwise the act of consolidation is to return the two non-touching ranges. |
|
* Otherwise the act of consolidation is to return the two non-touching ranges. |
|
|
|
|
|
|
|
⚫ |
Given '''N ''' ranges where '''N > 2 ''' then the result is the same as repeatedly replacing all combinations of two ranges by their consolidation until no further consolidation between range pairs is possible. |
|
|
|
|
|
If '''N < 2''' then range consolidation has no strict meaning and the input can be returned. |
|
|
|
|
|
|
|
⚫ |
|
|
⚫ |
: Given the two ranges '''[1, 2.5] ''' and '''[3, 4.2] ''' then |
|
⚫ |
: there is no common region between the ranges and the result is the same as the input. |
|
|
|
|
|
|
|
⚫ |
|
|
⚫ |
: Given the two ranges '''[1, 2.5] ''' and '''[1.8, 4.7] ''' then |
|
|
: there is : an overlap '''[2.5, 1.8]''' between the ranges and |
|
⚫ |
: the result is the single range '''[1, 4. 7] '''. |
|
⚫ |
: Note that order of bounds in a range is not (yet) stated. |
|
|
|
|
|
|
|
⚫ |
|
|
⚫ |
: Given the two ranges '''[6.1, 7.2] ''' and '''[7.2, 8.3] ''' then |
|
|
: they touch at '''7.2''' and |
|
|
: the result is the single range '''[6.1, 8.3]'''. |
|
|
|
|
|
|
|
⚫ |
|
|
⚫ |
: Given the three ranges '''[1, 2] ''' and '''[4, 8] ''' and '''[2, 5] ''' |
|
⚫ |
: then there is no intersection of the ranges '''[1, 2] ''' and '''[4, 8] ''' |
|
⚫ |
: but the ranges '''[1, 2] ''' and '''[2, 5] ''' overlap and |
|
|
: consolidate to produce the range '''[1, 5]'''. |
|
⚫ |
: This range, in turn, overlaps the other range '''[4, 8]''', and |
|
⚫ |
: so consolidates to the final output of the single range '''[1, 8]'''. |
|
|
|
|
|
|
|
|
⚫ |
|
⚫ |
Given N ranges where N>2 then the result is the same as repeatedly replacing all combinations of two ranges by their consolidation until no further consolidation between range pairs is possible . If N<2 then range consolidation has no strict meaning and the input can be returned. |
|
|
⚫ |
Let a normalized range display show the smaller bound to the left ; and show the |
|
⚫ |
range with the smaller lower bound to the left of other ranges when showing multiple ranges. |
|
|
|
|
|
⚫ |
Output the '' normalized'' result of applying consolidation to these five sets of ranges: <big> |
⚫ |
|
|
|
⚫ |
|
⚫ |
:Given the two ranges <tt>[1, 2.5] </tt> and <tt>[3, 4.2] </tt> then there is no |
|
|
⚫ |
|
⚫ |
:common region between the ranges and the result is the same as the input. |
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
[4, 3], [2, 1], [-1, -2], [3.9, 10] |
⚫ |
:Given the two ranges <tt>[1, 2.5] </tt> and <tt>[1.8, 4.7] </tt> then there is |
|
|
⚫ |
[1, 3], [-6, -1], [-4, -5], [8, 2], [-6, -6] </big> |
|
:an overlap <tt>[2.5, 1.8]</tt> between the ranges and the result is the single |
|
|
⚫ |
|
⚫ |
: range <tt>[1, 4.7]</tt>. Note that order of bounds in a range is not , (yet) , stated. |
|
⚫ |
|
|
⚫ |
:Given the two ranges <tt>[6.1, 7.2] </tt> and <tt>[7.2, 8.3] </tt> then they |
|
⚫ |
: touch at <tt>7.2</tt> and the result is the single range <tt>[ 6.1, 8. 3] </tt>. |
|
⚫ |
|
|
⚫ |
:Given the three ranges <tt>[1, 2] </tt> and <tt>[4, 8] </tt> and <tt>[2, 5] </tt> |
|
⚫ |
:then there is no intersection of the ranges <tt>[1, 2] </tt> and <tt>[4, 8] </tt> |
|
⚫ |
:but the ranges <tt>[1, 2] </tt> and <tt>[2, 5] </tt> overlap and consolidate to |
|
⚫ |
: produce the range <tt>[1, 5]</tt>. This range, in turn, overlaps the other range |
|
⚫ |
: <tt>[4, 8]</tt>, and so consolidates to the final output of the single range |
|
|
:<tt>[1, 8]</tt> |
|
|
|
|
|
⚫ |
|
|
⚫ |
Let a normalized range display show the smaller bound to the left; and show the |
|
⚫ |
range with the smaller lower bound to the left of other ranges when showing multiple |
|
|
ranges. |
|
|
|
|
|
|
⚫ |
|
⚫ |
Output the '' normalised'' result of applying consolidation to these five sets of ranges: |
|
|
<pre> |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
[4, 3], [2, 1], [-1, -2], [3.9, 10] |
|
⚫ |
[1, 3], [-6, -1], [-4, -5], [8, 2], [-6, -6] |
|
|
</pre> |
|
⚫ |
|
|
|
<br> |
|
|
<br> |
|
⚫ |
|
|
|
* [[Set consolidation]] |
|
* [[Set consolidation]] |
|
* [[Set of real numbers]] |
|
* [[Set of real numbers]] |