<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wcipeg.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Half-open_interval</id>
		<title>Half-open interval - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wcipeg.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Half-open_interval"/>
		<link rel="alternate" type="text/html" href="http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;action=history"/>
		<updated>2026-04-24T09:16:17Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.25.2</generator>

	<entry>
		<id>http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;diff=1651&amp;oldid=prev</id>
		<title>Brian at 02:56, 14 May 2012</title>
		<link rel="alternate" type="text/html" href="http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;diff=1651&amp;oldid=prev"/>
				<updated>2012-05-14T02:56:39Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 02:56, 14 May 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;L1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;left &lt;/del&gt;half-open interval''' is an interval of the form &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt;; it contains all &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;a \leq x &amp;lt; b&amp;lt;/math&amp;gt;. It is often useful to express problems, [[algorithm]]s, [[data structure]]s, and library functions in terms of &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;left &lt;/del&gt;half-open intervals of integers; a segment of an array is then specified by giving the left endpoint, that is, the index to the first element in the segment, and the right endpoint, which is the element ''just after'' the last element in the segment. For example, in C++, to sort a segment of an array &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt; from the third element to the sixth element, inclusive, the code is &amp;lt;code&amp;gt;std::sort(A+3, A+7);&amp;lt;/code&amp;gt;. The STL containers &amp;lt;code&amp;gt;std::vector&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::list&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::deque&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::set&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;std::map&amp;lt;/code&amp;gt; all have two member functions, &amp;lt;code&amp;gt;begin()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;end()&amp;lt;/code&amp;gt;, where the latter returns an iterator, not to the actual last element in the container, but to an imaginary element &amp;quot;just past the end&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;right &lt;/ins&gt;half-open interval''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(less commonly ''left half-closed interval'') &lt;/ins&gt;is an interval of the form &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt;; it contains all &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;a \leq x &amp;lt; b&amp;lt;/math&amp;gt;. It is often useful to express problems, [[algorithm]]s, [[data structure]]s, and library functions in terms of &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;right &lt;/ins&gt;half-open intervals of integers; a segment of an array is then specified by giving the left endpoint, that is, the index to the first element in the segment, and the right endpoint, which is the element ''just after'' the last element in the segment. For example, in C++, to sort a segment of an array &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt; from the third element to the sixth element, inclusive, the code is &amp;lt;code&amp;gt;std::sort(A+3, A+7);&amp;lt;/code&amp;gt;. The STL containers &amp;lt;code&amp;gt;std::vector&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::list&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::deque&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::set&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;std::map&amp;lt;/code&amp;gt; all have two member functions, &amp;lt;code&amp;gt;begin()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;end()&amp;lt;/code&amp;gt;, where the latter returns an iterator, not to the actual last element in the container, but to an imaginary element &amp;quot;just past the end&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Left &lt;/del&gt;half-open intervals are convenient because they have the following desirable properties:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Right &lt;/ins&gt;half-open intervals are convenient because they have the following desirable properties:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; contains &amp;lt;math&amp;gt;b-a&amp;lt;/math&amp;gt; elements exactly (rather than &amp;lt;math&amp;gt;b-a+1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;b-a-1&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; contains &amp;lt;math&amp;gt;b-a&amp;lt;/math&amp;gt; elements exactly (rather than &amp;lt;math&amp;gt;b-a+1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;b-a-1&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The interval of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; starting at &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; can simply be denoted &amp;lt;math&amp;gt;[i,i+n)&amp;lt;/math&amp;gt;, rather than the more cumbersome &amp;lt;math&amp;gt;[i,i+n-1]&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The interval of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; starting at &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; can simply be denoted &amp;lt;math&amp;gt;[i,i+n)&amp;lt;/math&amp;gt;, rather than the more cumbersome &amp;lt;math&amp;gt;[i,i+n-1]&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The ''disjoint'' union of &amp;lt;math&amp;gt;[i,j)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;[j,k)&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;[i,k)&amp;lt;/math&amp;gt;; and likewise any &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;left &lt;/del&gt;half-open interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; may be divided by intermediate values &amp;lt;math&amp;gt;a &amp;lt; c_0 &amp;lt; c_1 &amp;lt; ... &amp;lt; c_n &amp;lt; b&amp;lt;/math&amp;gt; into a disjoint union of &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;left &lt;/del&gt;half-open intervals &amp;lt;math&amp;gt;[a,c_0) \cup [c_0,c_1) \cup [c_1,c_2) \cup ... \cup [c_n, b)&amp;lt;/math&amp;gt;; ''i.e.'', endpoints telescope nicely with half-open intervals, whereas they do not with fully open or fully closed intervals.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The ''disjoint'' union of &amp;lt;math&amp;gt;[i,j)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;[j,k)&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;[i,k)&amp;lt;/math&amp;gt;; and likewise any &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;right &lt;/ins&gt;half-open interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; may be divided by intermediate values &amp;lt;math&amp;gt;a &amp;lt; c_0 &amp;lt; c_1 &amp;lt; ... &amp;lt; c_n &amp;lt; b&amp;lt;/math&amp;gt; into a disjoint union of &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;right &lt;/ins&gt;half-open intervals &amp;lt;math&amp;gt;[a,c_0) \cup [c_0,c_1) \cup [c_1,c_2) \cup ... \cup [c_n, b)&amp;lt;/math&amp;gt;; ''i.e.'', endpoints telescope nicely with half-open intervals, whereas they do not with fully open or fully closed intervals.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* See also [[prefix sum array and difference array]].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* See also [[prefix sum array and difference array]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Here is an example of when &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;left &lt;/del&gt;half-open intervals may be useful. We usually think of one-dimensional [[array]]s as being lines of boxes, where each box represents an element. Sometimes, we want to use a one-dimensional array to store some information about exact points in time; maybe something happens exactly at ''t'' = 15 s and ends exactly at ''t'' = 21 s. A second is an interval delineated by two points (that are, by definition, one second apart); a second is like a box, but a point in time is like one of the lines that separates two boxes. We can represent the interval in time between 15 s and 21 s as the half-open interval [15, 21); that is, identify each box in the array with the point of time when it ''starts''. Since the last second of the event is between 20 s and 21 s (instead of 21 s and 22 s), the box at index 21 is not used.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Here is an example of when &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;right &lt;/ins&gt;half-open intervals may be useful. We usually think of one-dimensional [[array]]s as being lines of boxes, where each box represents an element. Sometimes, we want to use a one-dimensional array to store some information about exact points in time; maybe something happens exactly at ''t'' = 15 s and ends exactly at ''t'' = 21 s. A second is an interval delineated by two points (that are, by definition, one second apart); a second is like a box, but a point in time is like one of the lines that separates two boxes. We can represent the interval in time between 15 s and 21 s as the half-open interval [15, 21); that is, identify each box in the array with the point of time when it ''starts''. Since the last second of the event is between 20 s and 21 s (instead of 21 s and 22 s), the box at index 21 is not used.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The choice of &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;left &lt;/del&gt;half-open intervals over &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;right &lt;/del&gt;half-open intervals is arbitrary, but appears to be a ''de facto'' standard.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The choice of &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;right &lt;/ins&gt;half-open intervals over &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;left &lt;/ins&gt;half-open intervals is arbitrary, but appears to be a ''de facto'' standard.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Brian</name></author>	</entry>

	<entry>
		<id>http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;diff=1495&amp;oldid=prev</id>
		<title>Brian at 08:11, 15 December 2011</title>
		<link rel="alternate" type="text/html" href="http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;diff=1495&amp;oldid=prev"/>
				<updated>2011-12-15T08:11:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 08:11, 15 December 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;L5&quot; &gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The interval of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; starting at &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; can simply be denoted &amp;lt;math&amp;gt;[i,i+n)&amp;lt;/math&amp;gt;, rather than the more cumbersome &amp;lt;math&amp;gt;[i,i+n-1]&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The interval of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; starting at &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; can simply be denoted &amp;lt;math&amp;gt;[i,i+n)&amp;lt;/math&amp;gt;, rather than the more cumbersome &amp;lt;math&amp;gt;[i,i+n-1]&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The ''disjoint'' union of &amp;lt;math&amp;gt;[i,j)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;[j,k)&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;[i,k)&amp;lt;/math&amp;gt;; and likewise any left half-open interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; may be divided by intermediate values &amp;lt;math&amp;gt;a &amp;lt; c_0 &amp;lt; c_1 &amp;lt; ... &amp;lt; c_n &amp;lt; b&amp;lt;/math&amp;gt; into a disjoint union of left half-open intervals &amp;lt;math&amp;gt;[a,c_0) \cup [c_0,c_1) \cup [c_1,c_2) \cup ... \cup [c_n, b)&amp;lt;/math&amp;gt;; ''i.e.'', endpoints telescope nicely with half-open intervals, whereas they do not with fully open or fully closed intervals.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The ''disjoint'' union of &amp;lt;math&amp;gt;[i,j)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;[j,k)&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;[i,k)&amp;lt;/math&amp;gt;; and likewise any left half-open interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; may be divided by intermediate values &amp;lt;math&amp;gt;a &amp;lt; c_0 &amp;lt; c_1 &amp;lt; ... &amp;lt; c_n &amp;lt; b&amp;lt;/math&amp;gt; into a disjoint union of left half-open intervals &amp;lt;math&amp;gt;[a,c_0) \cup [c_0,c_1) \cup [c_1,c_2) \cup ... \cup [c_n, b)&amp;lt;/math&amp;gt;; ''i.e.'', endpoints telescope nicely with half-open intervals, whereas they do not with fully open or fully closed intervals.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* See also [[prefix sum array and difference array]].&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Here is an example of when left half-open intervals may be useful. We usually think of one-dimensional [[array]]s as being lines of boxes, where each box represents an element. Sometimes, we want to use a one-dimensional array to store some information about exact points in time; maybe something happens exactly at ''t'' = 15 s and ends exactly at ''t'' = 21 s. A second is an interval delineated by two points (that are, by definition, one second apart); a second is like a box, but a point in time is like one of the lines that separates two boxes. We can represent the interval in time between 15 s and 21 s as the half-open interval [15, 21); that is, identify each box in the array with the point of time when it ''starts''. Since the last second of the event is between 20 s and 21 s (instead of 21 s and 22 s), the box at index 21 is not used.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Here is an example of when left half-open intervals may be useful. We usually think of one-dimensional [[array]]s as being lines of boxes, where each box represents an element. Sometimes, we want to use a one-dimensional array to store some information about exact points in time; maybe something happens exactly at ''t'' = 15 s and ends exactly at ''t'' = 21 s. A second is an interval delineated by two points (that are, by definition, one second apart); a second is like a box, but a point in time is like one of the lines that separates two boxes. We can represent the interval in time between 15 s and 21 s as the half-open interval [15, 21); that is, identify each box in the array with the point of time when it ''starts''. Since the last second of the event is between 20 s and 21 s (instead of 21 s and 22 s), the box at index 21 is not used.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The choice of left half-open intervals over right half-open intervals is arbitrary, but appears to be a ''de facto'' standard.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The choice of left half-open intervals over right half-open intervals is arbitrary, but appears to be a ''de facto'' standard.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Brian</name></author>	</entry>

	<entry>
		<id>http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;diff=1448&amp;oldid=prev</id>
		<title>Brian at 23:05, 22 November 2011</title>
		<link rel="alternate" type="text/html" href="http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;diff=1448&amp;oldid=prev"/>
				<updated>2011-11-22T23:05:04Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 23:05, 22 November 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;L2&quot; &gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Left half-open intervals are convenient because they have the following desirable properties:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Left half-open intervals are convenient because they have the following desirable properties:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* The interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; contains &amp;lt;math&amp;gt;b-a&amp;lt;/math&amp;gt; elements exactly (rather than &amp;lt;math&amp;gt;b-a+1&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;b-a-1&amp;lt;/math&amp;gt;).&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The interval of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; starting at &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; can simply be denoted &amp;lt;math&amp;gt;[i,i+n)&amp;lt;/math&amp;gt;, rather than the more cumbersome &amp;lt;math&amp;gt;[i,i+n-1]&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The interval of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; starting at &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; can simply be denoted &amp;lt;math&amp;gt;[i,i+n)&amp;lt;/math&amp;gt;, rather than the more cumbersome &amp;lt;math&amp;gt;[i,i+n-1]&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The ''disjoint'' union of &amp;lt;math&amp;gt;[i,j)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;[j,k)&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;[i,k)&amp;lt;/math&amp;gt;; and likewise any left half-open interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; may be divided by intermediate values &amp;lt;math&amp;gt;a &amp;lt; c_0 &amp;lt; c_1 &amp;lt; ... &amp;lt; c_n &amp;lt; b&amp;lt;/math&amp;gt; into a disjoint union of left half-open intervals &amp;lt;math&amp;gt;[a,c_0) \cup [c_0,c_1) \cup [c_1,c_2) \cup ... \cup [c_n, b)&amp;lt;/math&amp;gt;; ''i.e.'', endpoints telescope nicely with half-open intervals, whereas they do not with fully open or fully closed intervals.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* The ''disjoint'' union of &amp;lt;math&amp;gt;[i,j)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;[j,k)&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;[i,k)&amp;lt;/math&amp;gt;; and likewise any left half-open interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; may be divided by intermediate values &amp;lt;math&amp;gt;a &amp;lt; c_0 &amp;lt; c_1 &amp;lt; ... &amp;lt; c_n &amp;lt; b&amp;lt;/math&amp;gt; into a disjoint union of left half-open intervals &amp;lt;math&amp;gt;[a,c_0) \cup [c_0,c_1) \cup [c_1,c_2) \cup ... \cup [c_n, b)&amp;lt;/math&amp;gt;; ''i.e.'', endpoints telescope nicely with half-open intervals, whereas they do not with fully open or fully closed intervals.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Brian</name></author>	</entry>

	<entry>
		<id>http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;diff=1447&amp;oldid=prev</id>
		<title>Brian: Created page with &quot;A '''left half-open interval''' is an interval of the form &lt;math&gt;[a,b)&lt;/math&gt;; it contains all &lt;math&gt;x&lt;/math&gt; such that &lt;math&gt;a \leq x &lt; b&lt;/math&gt;. It is often useful to express p...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wcipeg.com/wiki/index.php?title=Half-open_interval&amp;diff=1447&amp;oldid=prev"/>
				<updated>2011-11-21T17:19:56Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;A &amp;#039;&amp;#039;&amp;#039;left half-open interval&amp;#039;&amp;#039;&amp;#039; is an interval of the form &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt;; it contains all &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;a \leq x &amp;lt; b&amp;lt;/math&amp;gt;. It is often useful to express p...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A '''left half-open interval''' is an interval of the form &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt;; it contains all &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;a \leq x &amp;lt; b&amp;lt;/math&amp;gt;. It is often useful to express problems, [[algorithm]]s, [[data structure]]s, and library functions in terms of left half-open intervals of integers; a segment of an array is then specified by giving the left endpoint, that is, the index to the first element in the segment, and the right endpoint, which is the element ''just after'' the last element in the segment. For example, in C++, to sort a segment of an array &amp;lt;code&amp;gt;A&amp;lt;/code&amp;gt; from the third element to the sixth element, inclusive, the code is &amp;lt;code&amp;gt;std::sort(A+3, A+7);&amp;lt;/code&amp;gt;. The STL containers &amp;lt;code&amp;gt;std::vector&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::list&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::deque&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std::set&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;std::map&amp;lt;/code&amp;gt; all have two member functions, &amp;lt;code&amp;gt;begin()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;end()&amp;lt;/code&amp;gt;, where the latter returns an iterator, not to the actual last element in the container, but to an imaginary element &amp;quot;just past the end&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Left half-open intervals are convenient because they have the following desirable properties:&lt;br /&gt;
* The interval of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; starting at &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; can simply be denoted &amp;lt;math&amp;gt;[i,i+n)&amp;lt;/math&amp;gt;, rather than the more cumbersome &amp;lt;math&amp;gt;[i,i+n-1]&amp;lt;/math&amp;gt;.&lt;br /&gt;
* The ''disjoint'' union of &amp;lt;math&amp;gt;[i,j)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;[j,k)&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;[i,k)&amp;lt;/math&amp;gt;; and likewise any left half-open interval &amp;lt;math&amp;gt;[a,b)&amp;lt;/math&amp;gt; may be divided by intermediate values &amp;lt;math&amp;gt;a &amp;lt; c_0 &amp;lt; c_1 &amp;lt; ... &amp;lt; c_n &amp;lt; b&amp;lt;/math&amp;gt; into a disjoint union of left half-open intervals &amp;lt;math&amp;gt;[a,c_0) \cup [c_0,c_1) \cup [c_1,c_2) \cup ... \cup [c_n, b)&amp;lt;/math&amp;gt;; ''i.e.'', endpoints telescope nicely with half-open intervals, whereas they do not with fully open or fully closed intervals.&lt;br /&gt;
&lt;br /&gt;
Here is an example of when left half-open intervals may be useful. We usually think of one-dimensional [[array]]s as being lines of boxes, where each box represents an element. Sometimes, we want to use a one-dimensional array to store some information about exact points in time; maybe something happens exactly at ''t'' = 15 s and ends exactly at ''t'' = 21 s. A second is an interval delineated by two points (that are, by definition, one second apart); a second is like a box, but a point in time is like one of the lines that separates two boxes. We can represent the interval in time between 15 s and 21 s as the half-open interval [15, 21); that is, identify each box in the array with the point of time when it ''starts''. Since the last second of the event is between 20 s and 21 s (instead of 21 s and 22 s), the box at index 21 is not used.&lt;br /&gt;
&lt;br /&gt;
The choice of left half-open intervals over right half-open intervals is arbitrary, but appears to be a ''de facto'' standard.&lt;/div&gt;</summary>
		<author><name>Brian</name></author>	</entry>

	</feed>