<?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>dxmio.com &#187; Software Engineering</title>
	<atom:link href="http://www.dxmio.com/category/programming/softeng/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dxmio.com</link>
	<description>&#34;Brevity is the soul of wit.&#34; --William Shakespeare</description>
	<lastBuildDate>Mon, 07 Dec 2009 08:15:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Interview Code Snippets: Part 3</title>
		<link>http://www.dxmio.com/2009/12/07/interview-code-snippets-part-3/</link>
		<comments>http://www.dxmio.com/2009/12/07/interview-code-snippets-part-3/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 08:15:28 +0000</pubDate>
		<dc:creator>dxmio</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[interview]]></category>

		<guid isPermaLink="false">http://www.dxmio.com/?p=608</guid>
		<description><![CDATA[The latest in this series makes a shift from C++ to Java since that&#8217;s what I&#8217;ve been mucking about with lately. I&#8217;m in a little bit of a time squeeze at the moment so explanations will have to come later (though this code should be fairly readable and obvious what its doing).

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import [...]]]></description>
			<content:encoded><![CDATA[<p>The latest in this series makes a shift from C++ to Java since that&#8217;s what I&#8217;ve been mucking about with lately. I&#8217;m in a little bit of a time squeeze at the moment so explanations will have to come later (though this code should be fairly readable and obvious what its doing).</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Collection</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.HashMap</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Iterator</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Random</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Program
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		doMatrixSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		doMissingNumberSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		doFirstUnrepeated<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> doFirstUnrepeated<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> testString <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;nnnnnnnnxxnnpnn&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> testStringChars <span style="color: #339933;">=</span> testString.<span style="color: #006633;">toCharArray</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">class</span> EntryInfo
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> count<span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">int</span> firstPos<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		HashMap<span style="color: #339933;">&lt;</span>Character, EntryInfo<span style="color: #339933;">&gt;</span> stuff <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;</span>Character, EntryInfo<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> testStringChars.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			EntryInfo thisInfo<span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>stuff.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span>testStringChars<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				thisInfo <span style="color: #339933;">=</span> stuff.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>testStringChars<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				thisInfo.<span style="color: #006633;">count</span><span style="color: #339933;">++;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #009900;">&#123;</span>
				thisInfo <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> EntryInfo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				thisInfo.<span style="color: #006633;">count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
				thisInfo.<span style="color: #006633;">firstPos</span> <span style="color: #339933;">=</span> i<span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
			stuff.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>testStringChars<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>, thisInfo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span> minPosition <span style="color: #339933;">=</span> testStringChars.<span style="color: #006633;">length</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> 
&nbsp;
		Collection<span style="color: #339933;">&lt;</span>Character<span style="color: #339933;">&gt;</span> coll <span style="color: #339933;">=</span> stuff.<span style="color: #006633;">keySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Iterator<span style="color: #339933;">&lt;</span>Character<span style="color: #339933;">&gt;</span> iter <span style="color: #339933;">=</span> coll.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>iter.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">Character</span> thisChar <span style="color: #339933;">=</span> iter.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			EntryInfo thisInfo <span style="color: #339933;">=</span> stuff.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>thisChar<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>thisInfo.<span style="color: #006633;">count</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> thisInfo.<span style="color: #006633;">firstPos</span> <span style="color: #339933;">&lt;</span> minPosition<span style="color: #009900;">&#41;</span>
				minPosition <span style="color: #339933;">=</span> thisInfo.<span style="color: #006633;">firstPos</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;doFirstUnrepeated():<span style="color: #000099; font-weight: bold;">\t</span> First non-repeater: &quot;</span> <span style="color: #339933;">+</span> testStringChars<span style="color: #009900;">&#91;</span>minPosition<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> doMissingNumberSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> minInclusive <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> arr <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">6</span>,<span style="color: #cc66cc;">7</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">9</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> missingNums <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">int</span> missingNumsPtr <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span> shouldExist <span style="color: #339933;">=</span> minInclusive<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> arr.<span style="color: #006633;">length</span> <span style="color: #339933;">&amp;&amp;</span> missingNumsPtr <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> shouldExist<span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				missingNums<span style="color: #009900;">&#91;</span>missingNumsPtr<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> shouldExist<span style="color: #339933;">;</span>
				missingNumsPtr<span style="color: #339933;">++;</span>
			<span style="color: #009900;">&#125;</span>
			shouldExist<span style="color: #339933;">++;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;doMissingNumberSearch():<span style="color: #000099; font-weight: bold;">\t</span> Missing nums: &quot;</span> <span style="color: #339933;">+</span> missingNums<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; and &quot;</span> <span style="color: #339933;">+</span> missingNums<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> doMatrixSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> numRuns <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">int</span> numSteps <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> z <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> z <span style="color: #339933;">&lt;</span> numRuns<span style="color: #339933;">;</span> z<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">Random</span> rnd <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> arr <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">int</span> last <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> y <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> y <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span> y<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> x <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #000066; font-weight: bold;">int</span> newval <span style="color: #339933;">=</span> rnd.<span style="color: #006633;">nextInt</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> last<span style="color: #339933;">;</span>
					arr<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> newval <span style="color: #339933;">+</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>				
					last <span style="color: #339933;">=</span> newval<span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">int</span> toFind <span style="color: #339933;">=</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">;</span>
&nbsp;
			numSteps <span style="color: #339933;">+=</span> matrixSearch<span style="color: #009900;">&#40;</span>arr, toFind<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">double</span> averageSteps <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#41;</span>numSteps <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#41;</span>numRuns<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;doMatrixSearch():<span style="color: #000099; font-weight: bold;">\t</span> Average steps: &quot;</span> <span style="color: #339933;">+</span> averageSteps<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">int</span> matrixSearch<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> arr, <span style="color: #000066; font-weight: bold;">int</span> toFind<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">int</span> numSteps <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span> x <span style="color: #339933;">=</span> arr<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">length</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">int</span> y <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> y <span style="color: #339933;">&lt;</span> arr.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			numSteps<span style="color: #339933;">++;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>toFind <span style="color: #339933;">&lt;</span> arr<span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
				x<span style="color: #339933;">--;</span>
			<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>toFind <span style="color: #339933;">&gt;</span> arr<span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
				y<span style="color: #339933;">++;</span>
			<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>toFind <span style="color: #339933;">==</span> arr<span style="color: #009900;">&#91;</span>y<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> numSteps<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.dxmio.com/2009/12/07/interview-code-snippets-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Networking</title>
		<link>http://www.dxmio.com/2009/10/11/networking/</link>
		<comments>http://www.dxmio.com/2009/10/11/networking/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 00:24:48 +0000</pubDate>
		<dc:creator>dxmio</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[office politics]]></category>
		<category><![CDATA[programming language]]></category>
		<category><![CDATA[spolsky]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.dxmio.com/?p=571</guid>
		<description><![CDATA[Today I take another paragraph from one of Joel Spolsky&#8217;s posts and quote it here for emphasis on something I find very important:
&#8220;When a programmer complains about &#8220;politics&#8221;, they mean—very precisely—any situation in which personal considerations outweigh technical considerations. Nothing is more infuriating than when a developer is told to use a certain programming language, [...]]]></description>
			<content:encoded><![CDATA[<p>Today I take another paragraph from one of <a href="http://www.joelonsoftware.com/">Joel Spolsky</a>&#8217;s posts and quote it here for emphasis on something I find very important:</p>
<blockquote><p><em>&#8220;When a programmer complains about &#8220;politics&#8221;, they mean—very precisely—any situation in which personal considerations outweigh technical considerations. Nothing is more infuriating than when a developer is told to use a certain programming language, not the best one for the task at hand, because the boss likes it. Nothing is more maddening than when people are promoted because of their ability to network rather than being promoted strictly on merit. Nothing is more aggravating to a developer than being forced to do something that is technically inferior because someone higher than them in the organization, or someone better-connected, insists on it.&#8221;</em></p></blockquote>
<blockquote><p><em>&#8220;You do have to pay competitively, but all said, of all the things that programmers look at in deciding where to work, as long as the salaries are basically fair, they will be surprisingly low on their list of considerations, and offering high salaries is a surprisingly ineffective tool in overcoming problems like the fact that programmers get 15&#8243; monitors and salespeople yell at them all the time and the job involves making nuclear weapons out of baby seals.&#8221;</em></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.dxmio.com/2009/10/11/networking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vision</title>
		<link>http://www.dxmio.com/2009/10/06/vision/</link>
		<comments>http://www.dxmio.com/2009/10/06/vision/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 05:46:09 +0000</pubDate>
		<dc:creator>dxmio</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[vision]]></category>

		<guid isPermaLink="false">http://www.dxmio.com/?p=566</guid>
		<description><![CDATA[&#8220;If somebody tells you that the job of a bricklayer is to lay bricks on bricks then you will probably not want to be a bricklayer. But what if somebody told you about building a cathedral? It is the same with programming. You need a vision to make it meaningful.&#8221;
]]></description>
			<content:encoded><![CDATA[<blockquote><p><em>&#8220;If somebody tells you that the job of a bricklayer is to lay bricks on bricks then you will probably not want to be a bricklayer. But what if somebody told you about building a cathedral? It is the same with programming. You need a vision to make it meaningful.&#8221;</em></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.dxmio.com/2009/10/06/vision/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Abstractions</title>
		<link>http://www.dxmio.com/2009/10/02/abstractions/</link>
		<comments>http://www.dxmio.com/2009/10/02/abstractions/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 05:04:15 +0000</pubDate>
		<dc:creator>dxmio</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[EWU]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.dxmio.com/?p=564</guid>
		<description><![CDATA[Today I went back and re-read Joel Spolsky&#8217;s advice The Law of Leaky Abstractions and it hits a nail on the head about what peers from EWU were missing: 
&#8220;Learn how to do it manually first, then use abstractions to save time. Code generation tools which pretend to abstract out something, like all abstractions, leak, [...]]]></description>
			<content:encoded><![CDATA[<p>Today I went back and re-read Joel Spolsky&#8217;s advice <strong>The Law of Leaky Abstractions</strong> and it hits a nail on the head about what peers from EWU were missing: </p>
<p><em>&#8220;Learn how to do it manually first, then use abstractions to save time. Code generation tools which pretend to abstract out something, like all abstractions, leak, and the only way to deal with the leaks competently is to learn about how the abstractions work and what they are abstracting. So the abstractions save us time working, but they don&#8217;t save us time learning. And all this means that paradoxically, even as we have higher and higher level programming tools with better and better abstractions, <strong>becoming a proficient programmer is getting harder and harder</strong>.&#8221; </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dxmio.com/2009/10/02/abstractions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fall 2009</title>
		<link>http://www.dxmio.com/2009/08/12/fall-2009/</link>
		<comments>http://www.dxmio.com/2009/08/12/fall-2009/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 01:37:37 +0000</pubDate>
		<dc:creator>dxmio</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Call of Duty 4]]></category>
		<category><![CDATA[Demigod]]></category>
		<category><![CDATA[Food and Wine]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Team Fortress 2]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[apartment]]></category>
		<category><![CDATA[college]]></category>
		<category><![CDATA[dota]]></category>
		<category><![CDATA[economy]]></category>
		<category><![CDATA[family]]></category>
		<category><![CDATA[friends]]></category>
		<category><![CDATA[furtniture]]></category>
		<category><![CDATA[government]]></category>
		<category><![CDATA[lanparty]]></category>
		<category><![CDATA[moving]]></category>
		<category><![CDATA[seattle]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[team fortress 2]]></category>
		<category><![CDATA[tri-cities]]></category>
		<category><![CDATA[wine]]></category>

		<guid isPermaLink="false">http://www.dxmio.com/?p=553</guid>
		<description><![CDATA[I spent several months trying to locate a job in Seattle, but the economic situation displaced a lot of software developers who are now vying for the same positions as college graduates. I had many interviews and leads in Seattle, but in the end it proved too competitive to break into. Now that the ink [...]]]></description>
			<content:encoded><![CDATA[<p>I spent several months trying to locate a job in Seattle, but the economic situation displaced a lot of software developers who are now vying for the same positions as college graduates. I had many interviews and leads in Seattle, but in the end it proved too competitive to break into. Now that the ink has dried, I can reveal that instead I&#8217;ve been hired by a government research lab to do software maintenance in the Tri-Cities. This works out in the end since I have friends and family here. I know the area, the pay is good, and I&#8217;ll be doing what I like.</p>
<p>Since moving back, I&#8217;ve reconnected with friends from years past. There are two groups of friends, both of which who hold LANparties on a frequent basis, which is great. A lot of the problems that I&#8217;ve alluded to in the past about friends in this town have worked themselves out, so maybe karma exists after all. At any rate (I seem to be using the cliche &#8216;At any rate&#8217; often this week&#8230;), Susanna and I have a great new apartment, things to keep me entertained, friends to hang out with, and a stable job with great potential for advancement.</p>
<p>Seeing as how the Tri-Cities is wine country, I figured I&#8217;d ought to educate myself on wine and try all the different types around here. I&#8217;ll probably create a page on this website with wine reviews, and possibly open it to others to add to. So far, my favorites are a 2005 Hogue Late Harvest Reisling, and a 2006 Maryhill Cabernet Sauvignon. I have an iPhone app that gives me pointers on local wines that have won awards and where to find them, which is handy. Any advice on wine is greatly appreciated.</p>
<p>With all the LANparties I&#8217;ve gone to, I&#8217;ve started gaming more. So far I&#8217;ve been playing Team Fortress 2, Call of Duty 4, and a new game Demigod. Demigod is interesting because it&#8217;s the same idea as Warcraft 3: DOTA, but simplified and streamlined. Apparently the network code for the game was atrocious at release, but has since been greatly improved due to the popularity of the game.</p>
<p>Susanna and I haven&#8217;t moved all of our things from our old apartment yet, because my new employer is processing paperwork to pay for my relocation. Instead, we&#8217;ve moved the small stuff; Computers, food, hygiene, TV, couch, etc. It&#8217;s a very large apartment and without our furniture, it seems vacant at times.</p>
<p>Look for that wine review page soon. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dxmio.com/2009/08/12/fall-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning page</title>
		<link>http://www.dxmio.com/2009/07/11/learning-page/</link>
		<comments>http://www.dxmio.com/2009/07/11/learning-page/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 02:08:27 +0000</pubDate>
		<dc:creator>dxmio</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[improve]]></category>
		<category><![CDATA[learn]]></category>

		<guid isPermaLink="false">http://www.dxmio.com/?p=516</guid>
		<description><![CDATA[I kept updating my blog with a list of things I’d like to learn or improve upon, and it seemed redundant to continually copy/paste the information to a new post, just to update it. I would however like to keep the list online, so I’ve moved it to this single location.
]]></description>
			<content:encoded><![CDATA[<p>I kept updating my blog with a list of things I’d like to learn or improve upon, and it seemed redundant to continually copy/paste the information to a new post, just to update it. I would however like to keep the list online, so I’ve moved it to <a href="http://www.dxmio.com/to-learn/">this single location</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dxmio.com/2009/07/11/learning-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blog Considerations, Study List Updated</title>
		<link>http://www.dxmio.com/2009/06/28/blog-considerations-study-list-updated/</link>
		<comments>http://www.dxmio.com/2009/06/28/blog-considerations-study-list-updated/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 01:35:37 +0000</pubDate>
		<dc:creator>dxmio</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.dxmio.com/?p=481</guid>
		<description><![CDATA[Updated 6/29/2009 : 09:15pm
I&#8217;ve been thinking for some time about the possibility of starting another website. This blog is certainly where I post general goings-on with me and my programming, but I think it would be cool to create a website dedicated to teaching up-and-coming programmers things, categorized in an easy to navigate way. This [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Updated 6/29/2009 : 09:15pm</strong></p>
<p>I&#8217;ve been thinking for some time about the possibility of starting another website. This blog is certainly where I post general goings-on with me and my programming, but I think it would be cool to create a website dedicated to teaching up-and-coming programmers things, categorized in an easy to navigate way. This is partially inspired by <a href="http://www.stackoverflow.com">StackOverflow.com</a>, but would be targeted at a much lower skill level. My thought is that it wouldn&#8217;t necessarily be so basic as to teach things like loops and if statements, but more so at a level where things like algorithms and language constructs would be relevant. The reasoning behind creating a site like this is partially self serving:</p>
<blockquote><p>&#8220;Teaching is the highest form of understanding&#8221;.  &#8211;Aristotle</p></blockquote>
<p>I feel that by teaching what I know, might help me to even further my understanding of the subjects. The other reason for creating such a site is out of a dissatisfaction for the available knowledge on simpler programming subjects. Sites like stackoverflow are really good, but asking questions on there can be a tricky business if the question is simple, because there is a certain unspoken expectation that you are an above average knowledgeable programmer by using the site. This isn&#8217;t a blanket statement, and I don&#8217;t wish to be misunderstood when I talk about stackoverflow &#8211; I love stackoverflow and I&#8217;m an active participant. I just think it would be beneficial to have a website that caters to those who are just getting their feet wet in our industry, to get them excited about furthering their study beyond what they might be getting in a classroom environment. I&#8217;ve always <a href="http://stackoverflow.com/questions/947583/how-much-should-one-help-a-struggling-developer/947600#947600">felt that individual study time was critical</a> for anyone in our field, but that if someone isn&#8217;t all that excited about the field to begin with, they probably aren&#8217;t going to go out of their way to learn more about it on their own. The proposed site would give newcomers a taste.</p>
<p>I haven&#8217;t purchased a domain for this site, nor have I come up with design or content. It&#8217;s an idea that will probably float around in my head for a while before materializing fully.</p>
<p>I spent some time with my previously mentioned study list and determined that I could probably remove some things and add others. Below is the new list, with my current progress.</p>
<ul>
<li><del datetime="2009-06-28T13:31:33+00:00">Algorithm to reverse a string</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Linked List from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Quick Sort from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Insertion Sort from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Selection Sort from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Bubble Sort from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Singleton pattern</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Factory pattern</del></li>
<li><del datetime="2009-06-29T01:27:43+00:00">Maze solver</del></li>
<li>Composite pattern</li>
<li>Decorator pattern</li>
<li><del datetime="2009-06-28T13:31:33+00:00">Greedy algorithm</del></li>
<li>Backtracking algorithm</li>
<li>Memoization</li>
<li><del datetime="2009-06-28T13:31:33+00:00">Hash table from scratch</del></li>
<li>Binary tree class + search from scratch</li>
<li>Graph traversal algorithms</li>
<li>Heap from scratch</li>
<li><del datetime="2009-06-30T04:15:20+00:00">Preventing integer overflow</del></li>
<li>Web services in: Java, C#</li>
<li>Java command line compilation flags</li>
<li>GCC command line flags</li>
<li>Ant, Make</li>
<li>Eclipse project/build configurations</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dxmio.com/2009/06/28/blog-considerations-study-list-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Interviews</title>
		<link>http://www.dxmio.com/2009/06/28/interviews/</link>
		<comments>http://www.dxmio.com/2009/06/28/interviews/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 13:44:45 +0000</pubDate>
		<dc:creator>dxmio</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.dxmio.com/?p=477</guid>
		<description><![CDATA[I knew that when I started the job search, I would ultimately end up doing a lot of algorithm development in my interviews, so I made an investment in a good dry-erase whiteboard to practice on. I explained to Susanna that, as a programmer, a whiteboard is just as important as the computer or code [...]]]></description>
			<content:encoded><![CDATA[<p>I knew that when I started the job search, I would ultimately end up doing a lot of algorithm development in my interviews, so I made an investment in a good dry-erase whiteboard to practice on. I explained to Susanna that, as a programmer, a whiteboard is just as important as the computer or code itself, as a consequence of <a href="http://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two">Miller&#8217;s thoughts on human memory channel capacity</a>. We as programmers simply can&#8217;t juggle all the necessary things that we need to know in active memory &#8211; we need to write it down, plan it out. If you are a programmer, <u>you need a whiteboard</u>.</p>
<p>So for my interviews, I&#8217;ve been studying data structures, time complexity, design patterns, etc.. I spent some time writing a list of things I ought to study up on. Here&#8217;s my list, and my progress for studying.</p>
<ul>
<li><del datetime="2009-06-28T13:31:33+00:00">Algorithm to reverse a string</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Linked List from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Quick Sort from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Insertion Sort from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Selection Sort from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Bubble Sort from scratch</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Singleton pattern</del></li>
<li><del datetime="2009-06-28T13:31:33+00:00">Factory pattern</del></li>
<li>Composite pattern</li>
<li><del datetime="2009-06-28T13:31:33+00:00">Greedy algorithm</del></li>
<li>Backtracking algorithm</li>
<li>Memoization</li>
<li><del datetime="2009-06-28T13:31:33+00:00">Hash table from scratch</del></li>
<li>Binary tree class + search from scratch</li>
<li>Heap from scratch</li>
<li>Preventing integer overflow</li>
<li>Web services in: Java, C#</li>
<li>Java command line compilation + flags</li>
<li>GCC command line flags</li>
<li>Ant, Make</li>
<li>Eclipse project/build configurations</li>
</ul>
<p>The ones I haven&#8217;t studied up on I still feel confident that I could write if asked in an interview, but I&#8217;d still like to study up on them ahead of time. I also took the time to take all of my study/learning java code and organize it into a package hierarchy for easy access, and discovered a <a href="http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getResource(java.lang.String)">pretty easy way in java to pull resources in</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dxmio.com/2009/06/28/interviews/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
