<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Template Archives - Huahua&#039;s Tech Road</title>
	<atom:link href="https://zxi.mytechroad.com/blog/category/template/feed/" rel="self" type="application/rss+xml" />
	<link>https://zxi.mytechroad.com/blog/category/template/</link>
	<description></description>
	<lastBuildDate>Sun, 29 Dec 2019 18:39:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.0.8</generator>

<image>
	<url>https://zxi.mytechroad.com/blog/wp-content/uploads/2017/09/cropped-photo-32x32.jpg</url>
	<title>Template Archives - Huahua&#039;s Tech Road</title>
	<link>https://zxi.mytechroad.com/blog/category/template/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Binary search template 二分搜索模板</title>
		<link>https://zxi.mytechroad.com/blog/template/binary-search-template/</link>
					<comments>https://zxi.mytechroad.com/blog/template/binary-search-template/#respond</comments>
		
		<dc:creator><![CDATA[zxi]]></dc:creator>
		<pubDate>Sun, 29 Dec 2019 10:03:36 +0000</pubDate>
				<category><![CDATA[Template]]></category>
		<category><![CDATA[binary search]]></category>
		<category><![CDATA[O(logn)]]></category>
		<category><![CDATA[template]]></category>
		<guid isPermaLink="false">https://zxi.mytechroad.com/blog/?p=6012</guid>

					<description><![CDATA[<p>[crayon-663bf3d67495e876673827/] [crayon-663bf3d674964937799355/] Related Articles https://zxi.mytechroad.com/blog/sp/sp5-binary-search/ https://zxi.mytechroad.com/blog/sp/binary-search-ii-sp17/</p>
<p>The post <a rel="nofollow" href="https://zxi.mytechroad.com/blog/template/binary-search-template/">Binary search template 二分搜索模板</a> appeared first on <a rel="nofollow" href="https://zxi.mytechroad.com/blog">Huahua&#039;s Tech Road</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="responsive-tabs">
<h2 class="tabtitle">Python</h2>
<div class="tabcontent">

<pre class="crayon-plain-tag"># Author: Huahua
# Returns the smallest m in [l, r),
# s.t. cond(m) == True
# If not found returns r.
def binarySearch(l, r)
  while l &lt; r:
    m = l + (r - l) // 2
    if cond(m):
      r = m
    else
      l = m + 1
  return l</pre>
</div></div>



<div class="responsive-tabs">
<h2 class="tabtitle">C++</h2>
<div class="tabcontent">

<pre class="crayon-plain-tag">// Author: Huahua
// Returns the smallest m in [l, r),
// s.t. cond(m) == True
// If not found returns r.
int binarySearch(int l, int r) {
  while (l &lt; r) {
    int m = l + (r - l) / 2;
    if (cond(m)) r = m;
    else l = m + 1;
  }
  return l;
}</pre>
</div></div>



<h2><strong>Related Articles</strong></h2>



<ul><li><a href="https://zxi.mytechroad.com/blog/sp/sp5-binary-search/">https://zxi.mytechroad.com/blog/sp/sp5-binary-search/</a></li><li><a href="https://zxi.mytechroad.com/blog/sp/binary-search-ii-sp17/">https://zxi.mytechroad.com/blog/sp/binary-search-ii-sp17/</a></li></ul>
<p>The post <a rel="nofollow" href="https://zxi.mytechroad.com/blog/template/binary-search-template/">Binary search template 二分搜索模板</a> appeared first on <a rel="nofollow" href="https://zxi.mytechroad.com/blog">Huahua&#039;s Tech Road</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://zxi.mytechroad.com/blog/template/binary-search-template/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
