<?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>stoimen&#039;s web log</title>
	<atom:link href="/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>es6 swap variables</title>
		<link>/2018/02/13/es6-swap-variables/</link>
		<comments>/2018/02/13/es6-swap-variables/#respond</comments>
		<pubDate>Tue, 13 Feb 2018 08:18:15 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[es6]]></category>
		<category><![CDATA[gist]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">/?p=3666</guid>
		<description><![CDATA[<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/09/03/the-better-way-to-unset-variables-in-php/" rel="bookmark" title="The Better Way to Unset Variables in PHP">The Better Way to Unset Variables in PHP </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><script src="https://gist.github.com/stoimen/e81f9fd9f16ccaddbade7b0bf826c379.js"></script></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/09/03/the-better-way-to-unset-variables-in-php/" rel="bookmark" title="The Better Way to Unset Variables in PHP">The Better Way to Unset Variables in PHP </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2018/02/13/es6-swap-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Structures Infographic: Tree</title>
		<link>/2018/02/11/data-structures-infographic-tree/</link>
		<comments>/2018/02/11/data-structures-infographic-tree/#respond</comments>
		<pubDate>Sun, 11 Feb 2018 12:10:01 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[infographic]]></category>
		<category><![CDATA[B-tree]]></category>
		<category><![CDATA[Data structures]]></category>
		<category><![CDATA[quad tree]]></category>
		<category><![CDATA[Tree]]></category>

		<guid isPermaLink="false">/?p=3663</guid>
		<description><![CDATA[Find it on GitHub<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2017/09/10/data-structures-infographic-linked-list/" rel="bookmark" title="Data Structures Infographic: Linked List">Data Structures Infographic: Linked List </a></li>
<li><a href="/2017/09/14/data-structures-infographic-stack-queue/" rel="bookmark" title="Data Structures Infographic: Stack &#038; Queue">Data Structures Infographic: Stack &#038; Queue </a></li>
<li><a href="/2017/09/02/data-structures-infographic-arrays/" rel="bookmark" title="Data Structures Infographic: Arrays">Data Structures Infographic: Arrays </a></li>
<li><a href="/2012/06/22/computer-algorithms-binary-search-tree-data-structure/" rel="bookmark" title="Computer Algorithms: Binary Search Tree">Computer Algorithms: Binary Search Tree </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="https://raw.githubusercontent.com/stoimen/infographics/master/Tree.png"><img class="alignnone size-full" src="https://raw.githubusercontent.com/stoimen/infographics/master/Tree.png" alt="" width="800" height="1200" /></a></p>
<p>Find it on <a href="https://github.com/stoimen/infographics/blob/master/Tree.png">GitHub</a></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2017/09/10/data-structures-infographic-linked-list/" rel="bookmark" title="Data Structures Infographic: Linked List">Data Structures Infographic: Linked List </a></li>
<li><a href="/2017/09/14/data-structures-infographic-stack-queue/" rel="bookmark" title="Data Structures Infographic: Stack &#038; Queue">Data Structures Infographic: Stack &#038; Queue </a></li>
<li><a href="/2017/09/02/data-structures-infographic-arrays/" rel="bookmark" title="Data Structures Infographic: Arrays">Data Structures Infographic: Arrays </a></li>
<li><a href="/2012/06/22/computer-algorithms-binary-search-tree-data-structure/" rel="bookmark" title="Computer Algorithms: Binary Search Tree">Computer Algorithms: Binary Search Tree </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2018/02/11/data-structures-infographic-tree/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beautiful Quicksort</title>
		<link>/2018/01/04/beautiful-quicksort/</link>
		<comments>/2018/01/04/beautiful-quicksort/#respond</comments>
		<pubDate>Thu, 04 Jan 2018 13:52:19 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[code snippet]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[Quicksort]]></category>

		<guid isPermaLink="false">/?p=3653</guid>
		<description><![CDATA[<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/18/friday-algorithms-iterative-quicksort/" rel="bookmark" title="Friday Algorithms: Iterative Quicksort">Friday Algorithms: Iterative Quicksort </a></li>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
<li><a href="/2010/06/25/friday-algorithms-sorting-a-set-of-integers-far-quicker-than-quicksort/" rel="bookmark" title="Friday Algorithms: Sorting a Set of Integers &#8211; Far Quicker than Quicksort!">Friday Algorithms: Sorting a Set of Integers &#8211; Far Quicker than Quicksort! </a></li>
<li><a href="/2012/03/12/algorithm-cheatsheet-quicksort/" rel="bookmark" title="Algorithm cheatsheet: Quicksort">Algorithm cheatsheet: Quicksort </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><script src="https://gist.github.com/Birkenstab/f33baff80f3ae94889bc756bcff8ea6a.js"></script></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/18/friday-algorithms-iterative-quicksort/" rel="bookmark" title="Friday Algorithms: Iterative Quicksort">Friday Algorithms: Iterative Quicksort </a></li>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
<li><a href="/2010/06/25/friday-algorithms-sorting-a-set-of-integers-far-quicker-than-quicksort/" rel="bookmark" title="Friday Algorithms: Sorting a Set of Integers &#8211; Far Quicker than Quicksort!">Friday Algorithms: Sorting a Set of Integers &#8211; Far Quicker than Quicksort! </a></li>
<li><a href="/2012/03/12/algorithm-cheatsheet-quicksort/" rel="bookmark" title="Algorithm cheatsheet: Quicksort">Algorithm cheatsheet: Quicksort </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2018/01/04/beautiful-quicksort/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Structures Infographic: Stack &#038; Queue</title>
		<link>/2017/09/14/data-structures-infographic-stack-queue/</link>
		<comments>/2017/09/14/data-structures-infographic-stack-queue/#respond</comments>
		<pubDate>Thu, 14 Sep 2017 20:07:35 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[infographic]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Queue]]></category>
		<category><![CDATA[Stack]]></category>
		<category><![CDATA[structures]]></category>

		<guid isPermaLink="false">/?p=3649</guid>
		<description><![CDATA[Find it on GitHub<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2017/09/10/data-structures-infographic-linked-list/" rel="bookmark" title="Data Structures Infographic: Linked List">Data Structures Infographic: Linked List </a></li>
<li><a href="/2018/02/11/data-structures-infographic-tree/" rel="bookmark" title="Data Structures Infographic: Tree">Data Structures Infographic: Tree </a></li>
<li><a href="/2017/09/02/data-structures-infographic-arrays/" rel="bookmark" title="Data Structures Infographic: Arrays">Data Structures Infographic: Arrays </a></li>
<li><a href="/2012/06/05/computer-algorithms-stack-and-queue-data-structure/" rel="bookmark" title="Computer Algorithms: Stack and Queue">Computer Algorithms: Stack and Queue </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="https://raw.githubusercontent.com/stoimen/infographics/master/Stack_Queue.png"><img class="alignnone size-full wp-image-3643" src="https://raw.githubusercontent.com/stoimen/infographics/master/Stack_Queue.png" alt="" width="800" height="1200" /></a></p>
<p>Find it on <a href="https://github.com/stoimen/infographics/blob/master/Stack_Queue.png">GitHub</a></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2017/09/10/data-structures-infographic-linked-list/" rel="bookmark" title="Data Structures Infographic: Linked List">Data Structures Infographic: Linked List </a></li>
<li><a href="/2018/02/11/data-structures-infographic-tree/" rel="bookmark" title="Data Structures Infographic: Tree">Data Structures Infographic: Tree </a></li>
<li><a href="/2017/09/02/data-structures-infographic-arrays/" rel="bookmark" title="Data Structures Infographic: Arrays">Data Structures Infographic: Arrays </a></li>
<li><a href="/2012/06/05/computer-algorithms-stack-and-queue-data-structure/" rel="bookmark" title="Computer Algorithms: Stack and Queue">Computer Algorithms: Stack and Queue </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2017/09/14/data-structures-infographic-stack-queue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Structures Infographic: Linked List</title>
		<link>/2017/09/10/data-structures-infographic-linked-list/</link>
		<comments>/2017/09/10/data-structures-infographic-linked-list/#respond</comments>
		<pubDate>Sun, 10 Sep 2017 08:51:13 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[infographic]]></category>
		<category><![CDATA[Linked list]]></category>

		<guid isPermaLink="false">/?p=3642</guid>
		<description><![CDATA[Find it on GitHub<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2018/02/11/data-structures-infographic-tree/" rel="bookmark" title="Data Structures Infographic: Tree">Data Structures Infographic: Tree </a></li>
<li><a href="/2017/09/14/data-structures-infographic-stack-queue/" rel="bookmark" title="Data Structures Infographic: Stack &#038; Queue">Data Structures Infographic: Stack &#038; Queue </a></li>
<li><a href="/2017/09/02/data-structures-infographic-arrays/" rel="bookmark" title="Data Structures Infographic: Arrays">Data Structures Infographic: Arrays </a></li>
<li><a href="/2012/07/17/computer-algorithms-detecting-and-breaking-a-loop-in-a-linked-list/" rel="bookmark" title="Computer Algorithms: Detecting and Breaking a Loop in a Linked List">Computer Algorithms: Detecting and Breaking a Loop in a Linked List </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="/wp-content/uploads/2017/09/Linked_List.png"><img class="alignnone size-full wp-image-3643" src="https://raw.githubusercontent.com/stoimen/infographics/master/Linked_List.png" alt="" width="800" height="1200" /></a></p>
<p>Find it on <a href="https://github.com/stoimen/infographics/blob/master/Linked_List.png">GitHub</a></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2018/02/11/data-structures-infographic-tree/" rel="bookmark" title="Data Structures Infographic: Tree">Data Structures Infographic: Tree </a></li>
<li><a href="/2017/09/14/data-structures-infographic-stack-queue/" rel="bookmark" title="Data Structures Infographic: Stack &#038; Queue">Data Structures Infographic: Stack &#038; Queue </a></li>
<li><a href="/2017/09/02/data-structures-infographic-arrays/" rel="bookmark" title="Data Structures Infographic: Arrays">Data Structures Infographic: Arrays </a></li>
<li><a href="/2012/07/17/computer-algorithms-detecting-and-breaking-a-loop-in-a-linked-list/" rel="bookmark" title="Computer Algorithms: Detecting and Breaking a Loop in a Linked List">Computer Algorithms: Detecting and Breaking a Loop in a Linked List </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2017/09/10/data-structures-infographic-linked-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Structures Infographic: Arrays</title>
		<link>/2017/09/02/data-structures-infographic-arrays/</link>
		<comments>/2017/09/02/data-structures-infographic-arrays/#respond</comments>
		<pubDate>Sat, 02 Sep 2017 13:38:29 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[infographic]]></category>

		<guid isPermaLink="false">/?p=3635</guid>
		<description><![CDATA[Find it on GitHub<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2017/09/10/data-structures-infographic-linked-list/" rel="bookmark" title="Data Structures Infographic: Linked List">Data Structures Infographic: Linked List </a></li>
<li><a href="/2018/02/11/data-structures-infographic-tree/" rel="bookmark" title="Data Structures Infographic: Tree">Data Structures Infographic: Tree </a></li>
<li><a href="/2017/09/14/data-structures-infographic-stack-queue/" rel="bookmark" title="Data Structures Infographic: Stack &#038; Queue">Data Structures Infographic: Stack &#038; Queue </a></li>
<li><a href="/2012/07/24/php-arrays-or-linked-lists/" rel="bookmark" title="PHP: Arrays or Linked Lists?">PHP: Arrays or Linked Lists? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="https://raw.githubusercontent.com/stoimen/infographics/master/Array.png"><img class="alignnone size-full wp-image-3638" src="https://raw.githubusercontent.com/stoimen/infographics/master/Array.png" alt="" width="800" height="1200" /></a></p>
<p>Find it on <a href="https://github.com/stoimen/infographics/blob/master/Array.png">GitHub</a></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2017/09/10/data-structures-infographic-linked-list/" rel="bookmark" title="Data Structures Infographic: Linked List">Data Structures Infographic: Linked List </a></li>
<li><a href="/2018/02/11/data-structures-infographic-tree/" rel="bookmark" title="Data Structures Infographic: Tree">Data Structures Infographic: Tree </a></li>
<li><a href="/2017/09/14/data-structures-infographic-stack-queue/" rel="bookmark" title="Data Structures Infographic: Stack &#038; Queue">Data Structures Infographic: Stack &#038; Queue </a></li>
<li><a href="/2012/07/24/php-arrays-or-linked-lists/" rel="bookmark" title="PHP: Arrays or Linked Lists?">PHP: Arrays or Linked Lists? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2017/09/02/data-structures-infographic-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Array Unique</title>
		<link>/2015/05/04/javascript-array-unique/</link>
		<comments>/2015/05/04/javascript-array-unique/#comments</comments>
		<pubDate>Mon, 04 May 2015 13:15:39 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[Method]]></category>

		<guid isPermaLink="false">/?p=3600</guid>
		<description><![CDATA[<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/01/21/array-merge-in-javascript/" rel="bookmark" title="Array merge in JavaScript">Array merge in JavaScript </a></li>
<li><a href="/2009/03/07/flex-javascript-communication/" rel="bookmark" title="Flex Javascript communication">Flex Javascript communication </a></li>
<li><a href="/2009/03/12/javascript-rounded-corners/" rel="bookmark" title="JavaScript rounded corners">JavaScript rounded corners </a></li>
<li><a href="/2010/07/01/replace-the-broken-images-with-a-default-image-with-javascript/" rel="bookmark" title="Replace the Broken Images with a Default Image with JavaScript">Replace the Broken Images with a Default Image with JavaScript </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><script src="https://gist.github.com/stoimen/c42dcc2d57f6f68c3941.js"></script></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/01/21/array-merge-in-javascript/" rel="bookmark" title="Array merge in JavaScript">Array merge in JavaScript </a></li>
<li><a href="/2009/03/07/flex-javascript-communication/" rel="bookmark" title="Flex Javascript communication">Flex Javascript communication </a></li>
<li><a href="/2009/03/12/javascript-rounded-corners/" rel="bookmark" title="JavaScript rounded corners">JavaScript rounded corners </a></li>
<li><a href="/2010/07/01/replace-the-broken-images-with-a-default-image-with-javascript/" rel="bookmark" title="Replace the Broken Images with a Default Image with JavaScript">Replace the Broken Images with a Default Image with JavaScript </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2015/05/04/javascript-array-unique/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Computer Algorithms: Multiplication</title>
		<link>/2013/01/14/computer-algorithms-multiplication/</link>
		<comments>/2013/01/14/computer-algorithms-multiplication/#comments</comments>
		<pubDate>Mon, 14 Jan 2013 14:40:54 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[Addition]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[computer algorithms]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Multiplication]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">/?p=3531</guid>
		<description><![CDATA[Introduction Perhaps right after the addition at school we’ve learned how to multiply two numbers. This algorithm isn’t as easy as addition, but besides that we’re so familiar with it and that we even don’t recognize it as an “algorithm”. We just know it by heart. However, as I already said, multiplication is a bit &#8230; <a href="/2013/01/14/computer-algorithms-multiplication/" class="more-link">Continue reading <span class="screen-reader-text">Computer Algorithms: Multiplication</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2012/11/26/computer-algorithms-strassens-matrix-multiplication/" rel="bookmark" title="Computer Algorithms: Strassen&#8217;s Matrix Multiplication">Computer Algorithms: Strassen&#8217;s Matrix Multiplication </a></li>
<li><a href="/2012/05/15/computer-algorithms-karatsuba-fast-multiplication/" rel="bookmark" title="Computer Algorithms: Karatsuba Fast Multiplication">Computer Algorithms: Karatsuba Fast Multiplication </a></li>
<li><a href="/2011/12/26/computer-algorithms-binary-search/" rel="bookmark" title="Computer Algorithms: Binary Search">Computer Algorithms: Binary Search </a></li>
<li><a href="/2013/01/07/computer-algorithms-adding-large-integers/" rel="bookmark" title="Computer Algorithms: Adding Large Integers">Computer Algorithms: Adding Large Integers </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Perhaps right after the <a title="Computer Algorithms: Adding Large Integers" href="/2013/01/07/computer-algorithms-adding-large-integers/">addition </a>at school we’ve learned how to multiply two numbers. This algorithm isn’t as easy as addition, but besides that we’re so familiar with it and that we even don’t recognize it as an “algorithm”. We just know it by heart.</p>
<p>However, as I already said, multiplication is a bit more difficult than addition. This algorithm is interesting because for several reasons. First of all, let’s compare multiplication in binary and decimal.</p>
<p>So, let’s see how to multiply two numbers.</p>
<h2>Overview</h2>
<p>Multiplying and adding is practically the same thing, so where’s the difference?</p>
<p>It’s clear that a product of two numbers (each with N digits) can be represented as N sums, as we can see on the next picture.</p>
<figure id="attachment_3540" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/1.-Multiplication-Addition.png"><img class="size-full wp-image-3540" alt="Multiplication &amp; Addition" src="/wp-content/uploads/2013/01/1.-Multiplication-Addition.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/1.-Multiplication-Addition.png 620w, /wp-content/uploads/2013/01/1.-Multiplication-Addition-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<p>Now, for larger integers each time we shift left the next intermediate sum.</p>
<p><figure id="attachment_3539" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/2.-Multiplication.png"><img class="size-full wp-image-3539" alt="Multiplication" src="/wp-content/uploads/2013/01/2.-Multiplication.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/2.-Multiplication.png 620w, /wp-content/uploads/2013/01/2.-Multiplication-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure><span id="more-3531"></span></p>
<p>That is absolutely logical since we can represent the numbers as a sum of decimals divisible by 10 without a remainder.</p>
<figure id="attachment_3538" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/3.-Multiplication-Part-2.png"><img class="size-full wp-image-3538" alt="Multiplication " src="/wp-content/uploads/2013/01/3.-Multiplication-Part-2.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/3.-Multiplication-Part-2.png 620w, /wp-content/uploads/2013/01/3.-Multiplication-Part-2-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<h2>Binary Multiplication</h2>
<p>Sometimes binary is easier to work with than decimal and multiplication is just the case. As shown on the picture below binary multiplication is much easier compared to decimal.</p>
<figure id="attachment_3537" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/4.-Binary-Multiplication.png"><img class="size-full wp-image-3537" alt="Binary " src="/wp-content/uploads/2013/01/4.-Binary-Multiplication.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/4.-Binary-Multiplication.png 620w, /wp-content/uploads/2013/01/4.-Binary-Multiplication-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<p>That’s because we multiply only by 1 and 0, so the intermediate sum can be either the first number or 0.</p>
<p>In the oder hand, shifting left in binary equals multiplication by 2.</p>
<figure id="attachment_3536" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/5.-Binary-Shift-Left.png"><img class="size-full wp-image-3536" alt="Binary " src="/wp-content/uploads/2013/01/5.-Binary-Shift-Left.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/5.-Binary-Shift-Left.png 620w, /wp-content/uploads/2013/01/5.-Binary-Shift-Left-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<p>Why? Well, simply because the base is 2. It’s practically the same with decimals where shifting left equals multiplying by 10.</p>
<figure id="attachment_3535" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2013/01/6.-Decimal-Shift-Left.png"><img class="size-full wp-image-3535" alt="Decimal " src="/wp-content/uploads/2013/01/6.-Decimal-Shift-Left.png" width="620" height="399" srcset="/wp-content/uploads/2013/01/6.-Decimal-Shift-Left.png 620w, /wp-content/uploads/2013/01/6.-Decimal-Shift-Left-300x193.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></a><figcaption class="wp-caption-text">&nbsp;</figcaption></figure>
<p>The same applies of course for any base, i.e. hex F equals decimal 15 (since the first number is 0) and FF equals 255 (which is 16&#215;16 &#8211; 1).</p>
<h2>Can we do better?</h2>
<p>Unlike <a title="Computer Algorithms: Adding Large Integers" href="/2013/01/07/computer-algorithms-adding-large-integers/">addition</a>, here the answer is &#8211; yes, and we already know how to multiply faster (either decimal or binary numbers) using the <a title="Computer Algorithms: Karatsuba Fast Multiplication" href="/2012/05/15/computer-algorithms-karatsuba-fast-multiplication/">Karatsuba’s fast multiplication algorithm</a>.</p>
<h1>It’s Important Because …</h1>
<p>I&#8217;ve to admit that both addition and multiplication algorithms are fairly to understand, but we must remember that they are giving us the ground level for more complex cryptographic algorithms.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2012/11/26/computer-algorithms-strassens-matrix-multiplication/" rel="bookmark" title="Computer Algorithms: Strassen&#8217;s Matrix Multiplication">Computer Algorithms: Strassen&#8217;s Matrix Multiplication </a></li>
<li><a href="/2012/05/15/computer-algorithms-karatsuba-fast-multiplication/" rel="bookmark" title="Computer Algorithms: Karatsuba Fast Multiplication">Computer Algorithms: Karatsuba Fast Multiplication </a></li>
<li><a href="/2011/12/26/computer-algorithms-binary-search/" rel="bookmark" title="Computer Algorithms: Binary Search">Computer Algorithms: Binary Search </a></li>
<li><a href="/2013/01/07/computer-algorithms-adding-large-integers/" rel="bookmark" title="Computer Algorithms: Adding Large Integers">Computer Algorithms: Adding Large Integers </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2013/01/14/computer-algorithms-multiplication/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Computer Algorithms: Adding Large Integers</title>
		<link>/2013/01/07/computer-algorithms-adding-large-integers/</link>
		<comments>/2013/01/07/computer-algorithms-adding-large-integers/#comments</comments>
		<pubDate>Mon, 07 Jan 2013 15:16:47 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[Abstract algebra]]></category>
		<category><![CDATA[Addition]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[Arbitrary-precision arithmetic]]></category>
		<category><![CDATA[Binary numeral system]]></category>
		<category><![CDATA[Computer arithmetic]]></category>
		<category><![CDATA[Elementary arithmetic]]></category>
		<category><![CDATA[Elementary number theory]]></category>
		<category><![CDATA[faster algorithm]]></category>
		<category><![CDATA[Integer]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Number]]></category>
		<category><![CDATA[Radix sort]]></category>

		<guid isPermaLink="false">/?p=3525</guid>
		<description><![CDATA[Introduction We know how to add two integers using a perfectly simple and useful algorithm learned from school or even earlier. This is perhaps one of the very first techniques we learn in mathematics. However we need to answer few questions. First of all do computers use the same technique, since they use binary representation &#8230; <a href="/2013/01/07/computer-algorithms-adding-large-integers/" class="more-link">Continue reading <span class="screen-reader-text">Computer Algorithms: Adding Large Integers</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2012/12/24/computer-algorithms-sorting-in-linear-time/" rel="bookmark" title="Computer Algorithms: Sorting in Linear Time">Computer Algorithms: Sorting in Linear Time </a></li>
<li><a href="/2010/06/25/friday-algorithms-sorting-a-set-of-integers-far-quicker-than-quicksort/" rel="bookmark" title="Friday Algorithms: Sorting a Set of Integers &#8211; Far Quicker than Quicksort!">Friday Algorithms: Sorting a Set of Integers &#8211; Far Quicker than Quicksort! </a></li>
<li><a href="/2012/05/15/computer-algorithms-karatsuba-fast-multiplication/" rel="bookmark" title="Computer Algorithms: Karatsuba Fast Multiplication">Computer Algorithms: Karatsuba Fast Multiplication </a></li>
<li><a href="/2013/01/02/computer-algorithms-bucket-sort/" rel="bookmark" title="Computer Algorithms: Bucket Sort">Computer Algorithms: Bucket Sort </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>We know how to add two integers using a perfectly simple and useful algorithm learned from school or even earlier. This is perhaps one of the very first techniques we learn in mathematics. However we need to answer few questions. First of all do computers use the same technique, since they use binary representation of numbers? Is there a faster algorithm used by computers? What about boundaries and large integers?</p>
<h2>Overview</h2>
<p>Let’s start by explaining how we humans add two numbers. An important fact is that by adding two single-digit numbers we get at most two digit number. This can be proven by simply realizing that 9+9 = 18. This fact lays down in the way we add integers. Here’s how.</p>
<p><img src="https://docs.google.com/drawings/pub?id=11pxzTffU-mVas5OYWiFg2sdSUAXa-QvBD1pSewNao3A&amp;w=620&amp;h=399"></p>
<p>We just line-up the integers on their right-most digit and we start adding them in a column. In case we got a sum greater than 9 (let’s say 14) we keep only the right-most digit (the 4) and the 1 is added to the next sum.</p>
<p>Thus we get to the simple fact that by adding two n-digit integers we can have either an n-digit integer or a n+1 digit integer. As an example we see that by adding 53 + 35 (two 2-digit integers) we get 88, which is again 2-digit integer, but 53 + 54 result in 107, which is 3 digit integer. </p>
<p>That fact is practically true, as I mentioned above, for each pair of n-digit integers.</p>
<h3>What about binary numbers?</h3>
<p>In fact binaries can be added by using the exact same algorithm. At the example below we add two integers represented as binary numbers.</p>
<p><img src="https://docs.google.com/drawings/pub?id=1E376ILBpXg5fUU8JbxiKwIcSa8DxSDtaIjqVsCJCjWk&amp;w=620&amp;h=399"></p>
<p>As a matter of fact this algorithm is absolutely wonderful, because it works not only on decimals and binaries but in any base B.</p>
<p>Of course computers tend to perform better when adding integers that “fit” the machine word. However as we can see later this isn’t always the case and sometimes we need to add larger numbers that exceed the type boundaries.</p>
<h3>What about big integers?</h3>
<p>Since we know how to add “small” integers, it couldn’t be so hard to apply the same algorithm on big integers. The only problem is that the addition will be slower and sometimes (done by humans) can be error prone. </p>
<p>So practically the algorithm is the same, but we can’t just put a 1 billion integer into a standard computer type INT, right? That means that the tricky part here is the way we represent integers in our application. A common solution is to store the “big” integer into an array, thus each digit will be a separate array item. Then the operation of addition will be simple enough to be applied.</p>
<h2>Complexity</h2>
<p>When we talk about an algorithm that is so well known by every human being (or almost every) a common question is “is there anything faster” or “do computers use a different algorithm”. The answer may be surprising to someone, but unfortunately that is the fastest (optimal) algorithm for number addition. </p>
<p>Practically there’s nothing to optimize here. We just read the two n-digit numbers (O(n)), we apply “simple” addition to each digit and we carry over the 1 from the sums greater than 9 to the next &#8220;simple&#8221; addition. We don’t have loops or any complex operation in order to search for an optimization niche.</p>
<h2>Application</h2>
<p>It’s strange how often this algorithm is asked on coding interviews. Perhaps the catch is whether the interviewed person will start to look for a faster approach?! Thus is cool to know that this algorithm is optimal.</p>
<p>Sometimes we may ask ourselves why we humans use decimals. It’s considered because we have 10 fingers on our hands and this is perhaps true.</p>
<p>An interesting fact though, is that the Mayas (who barely predicted the end of the world a couple of weeks ago) used a system of a base 20. That is logical, since we have not 10, but total of 20 fingers considering our legs.</p>
<p>Finally, this algorithm may seem to easy to be explained but it lays down in more complex algorithms.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2012/12/24/computer-algorithms-sorting-in-linear-time/" rel="bookmark" title="Computer Algorithms: Sorting in Linear Time">Computer Algorithms: Sorting in Linear Time </a></li>
<li><a href="/2010/06/25/friday-algorithms-sorting-a-set-of-integers-far-quicker-than-quicksort/" rel="bookmark" title="Friday Algorithms: Sorting a Set of Integers &#8211; Far Quicker than Quicksort!">Friday Algorithms: Sorting a Set of Integers &#8211; Far Quicker than Quicksort! </a></li>
<li><a href="/2012/05/15/computer-algorithms-karatsuba-fast-multiplication/" rel="bookmark" title="Computer Algorithms: Karatsuba Fast Multiplication">Computer Algorithms: Karatsuba Fast Multiplication </a></li>
<li><a href="/2013/01/02/computer-algorithms-bucket-sort/" rel="bookmark" title="Computer Algorithms: Bucket Sort">Computer Algorithms: Bucket Sort </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2013/01/07/computer-algorithms-adding-large-integers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Computer Algorithms: Bucket Sort</title>
		<link>/2013/01/02/computer-algorithms-bucket-sort/</link>
		<comments>/2013/01/02/computer-algorithms-bucket-sort/#comments</comments>
		<pubDate>Wed, 02 Jan 2013 08:44:30 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[Bubble sort]]></category>
		<category><![CDATA[Bucket]]></category>
		<category><![CDATA[Bucket sort]]></category>
		<category><![CDATA[Combinatorics]]></category>
		<category><![CDATA[Counting sort]]></category>
		<category><![CDATA[Insertion sort]]></category>
		<category><![CDATA[linear sorting algorithm]]></category>
		<category><![CDATA[linear time sorting algorithms]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Order theory]]></category>
		<category><![CDATA[Radix sort]]></category>
		<category><![CDATA[Sort]]></category>
		<category><![CDATA[Sorting algorithms]]></category>
		<category><![CDATA[two linear time sorting algorithms]]></category>

		<guid isPermaLink="false">/?p=3526</guid>
		<description><![CDATA[Introduction What’s the fastest way to sort the following sequence [9, 3, 0, 5, 4, 1, 2, 6, 8, 7]? Well, the question is a bit tricky since the input is somehow “predefined”. First of all we have only integers, and fortunately they are all different. That’s great and we know that in practice it’s &#8230; <a href="/2013/01/02/computer-algorithms-bucket-sort/" class="more-link">Continue reading <span class="screen-reader-text">Computer Algorithms: Bucket Sort</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2012/12/24/computer-algorithms-sorting-in-linear-time/" rel="bookmark" title="Computer Algorithms: Sorting in Linear Time">Computer Algorithms: Sorting in Linear Time </a></li>
<li><a href="/2012/02/27/computer-algorithms-shell-sort/" rel="bookmark" title="Computer Algorithms: Shell Sort">Computer Algorithms: Shell Sort </a></li>
<li><a href="/2012/03/19/computer-algorithms-radix-sort/" rel="bookmark" title="Computer Algorithms: Radix Sort">Computer Algorithms: Radix Sort </a></li>
<li><a href="/2012/02/20/computer-algorithms-bubble-sort/" rel="bookmark" title="Computer Algorithms: Bubble Sort">Computer Algorithms: Bubble Sort </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>What’s the fastest way to sort the following sequence [9, 3, 0, 5, 4, 1, 2, 6, 8, 7]? Well, the question is a bit tricky since the input is somehow “predefined”. First of all we have only integers, and fortunately they are all different. That’s great and we know that in practice it’s almost impossible to count on such lucky coincidence. However here we can sort the sequence very quickly.</p>
<p>First of all we can pass through all these integers and by using an auxiliary array we can just put them at their corresponding index. We know in advance that that is going to work really well, because they are all different.</p>
<p><img src="https://docs.google.com/drawings/pub?id=1Aoz2O_azhtnea-w_sVma0VRFD0x3QA1Qc2TfZkW1vk8&amp;w=620&amp;h=399"></p>
<p>There is only one major problem in this solution. That’s because we assume all the integers are different. If not – we can just put all them in one single corresponding index.</p>
<p><img src="https://docs.google.com/drawings/pub?id=19NfzaQptazKwjjCOfoukXpbcL4ygNZUq5uXaUm7c3Mk&amp;w=620&amp;h=399"></p>
<p>That is why we can use bucket sort.</p>
<h2>Overview</h2>
<p>Bucket sort it’s the perfect sorting algorithm for the sequence above. We must know in advance that the integers are fairly well distributed over an interval (i, j). Then we can divide this interval in N equal sub-intervals (or buckets). We’ll put each number in its corresponding bucket. Finally for every bucket that contains more than one number we’ll use some linear sorting algorithm.</p>
<p><img src="https://docs.google.com/drawings/pub?id=19rpn5BY3JJOSpRPAJ9hpAoQeHVymxGxFNueuYCogmI4&amp;w=620&amp;h=399"></p>
<p>The thing is that we know that the integers are well distributed, thus we expect that there won’t be many buckets with more than one number inside.</p>
<p>That is why the sequence [1, 2, 3, 2, 1, 2, 3, 1] won’t be sorted faster than [4, 3, 1, 2, 9, 5, 4, 8].</p>
<h2>Pseudo Code</h2>
<pre>
1. Let n be the length of the input list L;
2. For each element i from L
   2.1. If B[i] is not empty
      2.1.1. Put A[i] into B[i] using insertion sort;
      2.1.2. Else B[i] := A[i] 
3. Concatenate B[i .. n] into one sorted list;
</pre>
<h2>Complexity</h2>
<p>The complexity of bucket sort isn’t constant depending on the input. However in the average case the complexity of the algorithm is O(n + k) where n is the length of the input sequence, while k is the number of buckets. </p>
<p>The problem is that its worst-case performance is O(n^2) which makes it as slow as bubble sort.</p>
<h2>Application</h2>
<p>As the other two linear time sorting algorithms (radix sort and counting sort) bucket sort depends so much on the input. The main thing we should be aware of is the way the input data is dispersed over an interval. </p>
<p>Another crucial thing is the number of buckets that can dramatically improve or worse the performance of the algorithm. </p>
<p>This makes bucket sort ideal in cases we know in advance that the input is well dispersed.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2012/12/24/computer-algorithms-sorting-in-linear-time/" rel="bookmark" title="Computer Algorithms: Sorting in Linear Time">Computer Algorithms: Sorting in Linear Time </a></li>
<li><a href="/2012/02/27/computer-algorithms-shell-sort/" rel="bookmark" title="Computer Algorithms: Shell Sort">Computer Algorithms: Shell Sort </a></li>
<li><a href="/2012/03/19/computer-algorithms-radix-sort/" rel="bookmark" title="Computer Algorithms: Radix Sort">Computer Algorithms: Radix Sort </a></li>
<li><a href="/2012/02/20/computer-algorithms-bubble-sort/" rel="bookmark" title="Computer Algorithms: Bubble Sort">Computer Algorithms: Bubble Sort </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2013/01/02/computer-algorithms-bucket-sort/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
