<?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>Informix Campus</title>
	<atom:link href="http://www.informixoncampus.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.informixoncampus.org</link>
	<description>The Blog</description>
	<lastBuildDate>Mon, 07 Jan 2013 10:47:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>How to solve a recursive problem without using recursion</title>
		<link>http://www.informixoncampus.org/how-to-solve-a-recursive-problem-without-using-recursion/</link>
		<comments>http://www.informixoncampus.org/how-to-solve-a-recursive-problem-without-using-recursion/#comments</comments>
		<pubDate>Mon, 07 Jan 2013 10:47:32 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/how-to-solve-a-recursive-problem-without-using-recursion/</guid>
		<description><![CDATA[Here is a typical algorithmic problem I encounter when interviewed: Write a program that receives a set of positive integers (duplicates are possible) and&#160;decides&#160;if the set of integers can be divided into three subsets with the same sum of elements. For instance, {1,1,1} can be divided into three subsets with equal sum {1} {1} {1}, [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/how-to-solve-a-recursive-problem-without-using-recursion/'/><div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="font-family: 'Times New Roman';"><span style="font-size: 15px;">Here is a typical algorithmic problem I encounter when interviewed:</span></span><br />
<span style="font-family: 'Times New Roman';"><span style="font-size: 15px;"><br /></span></span><br />
<span style="font-family: 'Times New Roman'; font-size: 11pt;">Write a program </span><span style="font-family: 'Times New Roman'; font-size: 11pt;">that receives a set of positive integers<br />
(duplicates are possible) and</span><span style="font-family: 'Times New Roman,Italic'; font-size: 11pt;">&nbsp;decides&nbsp;</span><span style="font-family: 'Times New Roman'; font-size: 11pt;">if the set of integers can be divided into three subsets with the same sum of elements. For instance, {</span><span style="font-family: 'Times New Roman'; font-size: 11pt;">1,1,1} can be divided into three subsets with equal sum {1} {1} {1}, {</span><span style="font-family: 'Times New Roman'; font-size: 11pt;">3,2,5,4,1,3} can also be&nbsp;</span><span style="font-family: 'Times New Roman'; font-size: 15px;">divided into three subsets with equal sum&nbsp;</span><span style="font-family: 'Times New Roman'; font-size: 11pt;">{1, 5}, {2, 4}, {3, 3}. {2,3,4,5} however canot be&nbsp;</span><span style="font-family: 'Times New Roman'; font-size: 15px;">divided into three subsets with equal sum.</span><br />
<span style="font-family: 'Times New Roman'; font-size: 15px;"><br /></span><br />
<span style="font-family: 'Times New Roman'; font-size: 11pt;">&nbsp;The problem can be easily solved using recursion but on an interview it is sometimes easier to come up with a non-recursive solution.</span><br />
<span style="font-family: 'Times New Roman'; font-size: 11pt;"><br /></span><br />
<span style="font-family: 'Times New Roman'; font-size: 11pt;"><b>The algorithm:</b></span><br />
<span style="font-family: 'Times New Roman'; font-size: 11pt;"><br /></span></p>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">a)</span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">If<br />
total sum of elements is not divisible by 3 without reminder, the subsets do not exist.<o:p></o:p></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">b)</span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">Count in base-3 from 0 to 3^N</span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">c)</span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">For each number sum all digits for each of the three subsets. if all three equal we return<br />
true, otherwise continue to the next number.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';"><br /></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';"><b>The<br />
theory:</b><o:p></o:p></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">For a<br />
group of objects (positive numbers in our case) we want to find all the<br />
possible ways to divide the objects between 3 different buckets. Lets number<br />
the buckets 0, 1, and 2, and lets assume for now that buckets are allowed to be<br />
empty but each object must be in one of the buckets. <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">How<br />
many ways are there to arrange 1 object into 3 buckets? The answer is 3 because<br />
the object can be placed in either one of the buckets. And using our notation:<br />
0 – object is in the first bucket, 1 – object is in the second bucket, 2 –<br />
object is in the third bucket.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">For 2<br />
objects we have 9 arrangements:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">00 –<br />
both objects are in the first bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">01 –<br />
the first object is in the first bucket and the second object is in the second<br />
bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">02 –<br />
the first object is in the first bucket and the second object is in the third<br />
bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">10 –<br />
the first object is in the second bucket and the second object is in the first<br />
bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">11 –<br />
both objects are in the second bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">12 –<br />
the first object is in the second bucket and the second object is in the third<br />
bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">20 –<br />
the first object is in the third bucket and the second object is in the first<br />
bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">21 –<br />
the first object is in the third bucket and the second object is in the second<br />
bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">22 –<br />
both objects are in the third bucket<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">Using<br />
the similar logic for 3 objects we would have 27 arrangements:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">000<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">001<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">002<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">010<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">011<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">012<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">020<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">021<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">022<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">100<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">…<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">221<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">222<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">And for<br />
n objects we would have 3^n arrangements. If we look at our example with 3<br />
objects we might notice that we start counting from 0, and go up all the way to<br />
2 and then suddenly go to 10 instead of 3. It actually looks like all the<br />
digits above 2 are missing. And there is a good reason why they are missing. We<br />
count in ternary numeral system</span><span style="color: #404040; font-family: 'Times New Roman';">&nbsp;or simply base 3. <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">So to<br />
find all the possible ways to divide a set of objects between 3 different buckets<br />
we just have to count in base 3. And to while we count we can calculate the<br />
total sum of all numbers in each bucket. For example for base 3 number<br />
010011202 and a set of positive numbers 2,4,3,7,8,2,7,2,7 we would calculate<br />
the sum for the first bucket 2+3+7+2, second bucket 4+8+2, and third bucket 7+7<br />
and see that all sums are equal to 14.<o:p></o:p></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">Of<br />
course our solution is suboptimal because we only care about the sum of each<br />
group and do care about the bucket order. 010011202 and 101100212 is the same<br />
number for our purposes because nothing changes if we switch the buckets.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: #404040; font-family: 'Times New Roman';">In<br />
fact, to calculate what the number of unique combinations is equal to we would have to learn&nbsp;<o:p></o:p></span><span style="color: #404040; font-family: 'Times New Roman';">Polya’s Counting Theory&#8230;</span></div>
<p>
<b>Java implementation:</b></p>
<p>import java.util.ArrayList;<br />
import java.util.Iterator;<br />
import java.util.List;</p>
<p>public class Main {</p>
<p><span class="Apple-tab-span" style="white-space: pre;"> </span>/**<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> * @param args<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> */<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) {<br />
<span class="Apple-tab-span" style="white-space: pre;">  </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; // List Example implement with ArrayList<br />
&nbsp; &nbsp; &nbsp; &nbsp; List&lt;Integer&gt; numbers &nbsp; = new ArrayList&lt;Integer&gt;();<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(4);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(10);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(4);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(7);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(7);<br />
&nbsp; &nbsp; &nbsp; &nbsp; numbers.add(7);<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; int n = numbers.size();<br />
&nbsp; &nbsp; &nbsp; &nbsp; int count = (int) Math.pow(3, n);</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; count; ++i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>String base3 = Integer.toString(i,3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>base3 = padLeft(base3, n);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println(&#8220;base3:&#8221; + base3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>int [] group = {0, 0, 0};<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>int k = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>Iterator&lt;Integer&gt; it=numbers.iterator();<br />
&nbsp; &nbsp;<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>while(it.hasNext())<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;">  </span>int groupId = Integer.parseInt(base3.substring(k,k+1));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;">  </span>Integer value=(Integer)it.next();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;">  </span>group[groupId] += value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;">  </span>++k;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>}</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (group[0] &gt; 0 &amp;&amp; group[0] == group[1] &amp;&amp; group[0] == group[2])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(&#8220;base3:&#8221; + base3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</p>
<p><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static String padLeft(String s, int n) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> &nbsp; &nbsp;return String.format(&#8220;%&#8221; + n + &#8220;s&#8221;, s).replace(&#8216; &#8216;, &#8217;0&#8242;); <br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</p>
<p>}</p>
<p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/how-to-solve-a-recursive-problem-without-using-recursion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quixey interview questions</title>
		<link>http://www.informixoncampus.org/quixey-interview-questions/</link>
		<comments>http://www.informixoncampus.org/quixey-interview-questions/#comments</comments>
		<pubDate>Sun, 06 Jan 2013 11:12:24 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/quixey-interview-questions/</guid>
		<description><![CDATA[http://www.quixey.com Quixey is a start-up that tries to optimize application search. A twenty something year old kid introduced himself as Quixey’s CTO. The CTO was a typical smart senior-year college kid who had a good idea and received a huge investment to implement it. There is no doubt the CTO is a smart guy but [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/quixey-interview-questions/'/><div dir="ltr" style="text-align: left;" trbidi="on"></p>
<div class="MsoNormal">http://www.quixey.com<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">Quixey is a start-up that tries to optimize application search.<o:p></o:p></div>
<div class="MsoNormal">A twenty something year old kid introduced himself as Quixey’s CTO.<o:p></o:p></div>
<div class="MsoNormal">The CTO was a typical smart senior-year college kid who had a good idea and received a huge investment to implement it.<o:p></o:p></div>
<div class="MsoNormal">There is no doubt the CTO is a smart guy but there is also little doubt that his way of thinking is extremely inflexible and that he thinks that he is the smartest person on the planet Earth.<o:p></o:p></div>
<div class="MsoNormal">Nevertheless, Quixey has a hard problem to solve and it looks like they are doing a good job.<o:p></o:p></div>
<div class="MsoNormal">And here in the valley, you either have your own company or you sell your skills to freaks.<o:p></o:p></div>
<div class="MsoNormal">Here are the questions:<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-left: .5in; mso-list: l0 level1 lfo1; text-indent: -.25in;"><!--[if !supportLists]--><span>1)<span style="font: 7.0pt &quot;Times New Roman&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]-->Calculate the sum: 1 + 2 + 4 + 8 + 16 + … + 1024<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
</div>
<div class="MsoNormal" style="margin-left: .5in;">Unless you are lucky, and remember the formula for the series from the high-school, you have to find a quick way to calculate the sum.<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">1,2,4,8 .. How do they look in binary?<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">00000000001<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">00000000010<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">00000000100<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">00000001000<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">And if add them all up, we get eleven ones:<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">11111111111<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">And 11111111111 = 100000000000 -1<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">And 100000000000 = 2048<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">So the answer is 2047.<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">And the closed formula is: 2^(n+1) &#8211; 1<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
</div>
<div class="MsoNormal" style="margin-left: .5in; mso-list: l0 level1 lfo1; text-indent: -.25in;"><!--[if !supportLists]--><span>2)<span style="font: 7.0pt &quot;Times New Roman&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]-->You are given a list that contains another list, an array of strings, or a string as its values. Write a function to print out all the strings in the list.<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-left: .5in;">That is a fairly simple question; just do not try to do it in C++ (like I did).<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
</div>
<div class="MsoNormal" style="margin-left: .5in;">The trick here is that we have to use recursion for if one of the values is a list.<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">i.e. sum += func(list);<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-left: .5in; mso-list: l0 level1 lfo1; text-indent: -.25in;"><!--[if !supportLists]--><span>3)<span style="font: 7.0pt &quot;Times New Roman&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]-->Write a JavaScript function countTo(n) that counts from 1 to n and call console.log for each number. Your function has to cleverly work around this ridiculous constraint: You&#8217;re not allowed to use JavaScript&#8217;s iterative control structures, for and while. (And you&#8217;re not allowed to make the interpreter execute those control structures using tricks like eval, or dynamically generated elements appended to the DOM tree.)<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>function countTo(n) {<o:p></o:p></div>
<div class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if (n &gt; 0) {<o:p></o:p></div>
<div class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>countTo(n-1);<o:p></o:p></div>
<div class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>console.log(n);<o:p></o:p></div>
<div class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></div>
<div class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>There is also a much trickier way to achieve that; for instance, using function pointer or template specialization in C++.<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-left: .5in; mso-list: l0 level1 lfo1; text-indent: -.25in;"><!--[if !supportLists]--><span>4)<span style="font: 7.0pt &quot;Times New Roman&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><!--[endif]-->A client connects to a server which will stream it N 32-bit integers and then disconnect, where N is a-priori unknown to the client. Describe an O(log N)-space algorithm you could run on the client that would return any of the N integers with probability 1/N. (The algorithm only gets run once.)<o:p></o:p></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">#include</span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #a31515;">&lt;iostream&gt;</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">#include</span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #a31515;">&lt;ctime&gt;</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">namespace</span> std;<o:p></o:p></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: Consolas; font-size: 9.5pt;">//</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: Consolas; font-size: 9.5pt;">// Generate a random integer [1,...,n] with probability 1/n </span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">int</span><span style="font-family: Consolas; font-size: 9.5pt;"> urand(<span style="color: blue;">int</span> n)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">if</span> (n &gt; 0)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">int</span> rnd = (<span style="color: blue;">int</span>) ((rand() / <span style="color: blue;">double</span>(RAND_MAX)) * n) +1;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">return</span> (rnd &gt; n) ? n : rnd;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;">
</div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">return</span> 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;">
</div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: Consolas; font-size: 9.5pt;">//</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: green; font-family: Consolas; font-size: 9.5pt;">// Reset the random number generator with the system clock.</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">void</span><span style="font-family: Consolas; font-size: 9.5pt;"> seed()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: Consolas; font-size: 9.5pt;"><span>&nbsp;&nbsp;&nbsp; </span>srand((<span style="color: blue;">unsigned</span> <span style="color: blue;">int</span>) time(NULL));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .25in; mso-layout-grid-align: none; text-autospace: none;"><span]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/quixey-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TS Interview</title>
		<link>http://www.informixoncampus.org/ts-interview/</link>
		<comments>http://www.informixoncampus.org/ts-interview/#comments</comments>
		<pubDate>Sat, 05 Jan 2013 11:55:35 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/ts-interview/</guid>
		<description><![CDATA[Not-so-easy C++ interview. 1) Can a class with a private destructor be instantiated? That is a tricky question because the answer is both yes and no. Yes, it can be instantiated on a heap. No, it cannot be instantiated on a stack. A class with a private destructor cannot be instantiated on a stack (Object [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/ts-interview/'/><div dir="ltr" style="text-align: left;" trbidi="on">
Not-so-easy C++ interview.</p>
<p>1)<span class="Apple-tab-span" style="white-space: pre;">	</span>Can a class with a private destructor be instantiated?</p>
<p>That is a tricky question because the answer is both yes and no.<br />
Yes, it can be instantiated on a heap.<br />
No, it cannot be instantiated on a stack.</p>
<p>A class with a private destructor cannot be instantiated on a stack (Object obj) because the compiler cannot call a destructor.<br />
It is okay to instantiate it on a heap because we control when the destructor is called.<br />
A class with a private destructor can destroy itself (delete this).</p>
<p>So when do we need a class that has no accessible destructor?<br />
A class that counts references should not be deleted by a user because the user does not know if all references have been released.</p>
<p>2)<span class="Apple-tab-span" style="white-space: pre;">	</span>What is a function object (FUNCTOR)?</p>
<p>An object that overloads the function call operator ()<br />
<code><br />
class compare<br />
{<br />
public:<br />
&nbsp; &nbsp; bool operator()(int A, int B) const<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return A &lt; B;<br />
&nbsp; &nbsp; }<br />
};<br />
</code></p>
<p>And here is a usage pattern:</p>
<p><code><br />
template &lt;class Functor&gt;<br />
void sorta(int* items, int count, Functor pred);<br />
</code></p>
<p>3)<span class="Apple-tab-span" style="white-space: pre;">	</span>Find n-th, from the tail, object in a linked list.</p>
<p>The question can be easily solved in O(n) time with two pointers.<br />
Start the second pointer n iterations after the first pointer.<br />
Once the first pointer has reached the end of the linked list, the first pointer is at n-th element from the end.</p>
<p>4)<span class="Apple-tab-span" style="white-space: pre;">	</span>Implement a URL caching mechanism</p>
<p>Cache speeds up fetch requests by storing results in fast memory.<br />
All practical cache algorithms, sooner or later, must expel items from cache.<br />
Least recently used (LRU) algorithm simply evicts items that are least used. LRU is frequently implemented using a priority queue.<br />
CLOCK algorithm is implemented using an array and it evicts the first unused item that it finds.</p>
<p>
5)<span class="Apple-tab-span" style="white-space: pre;">	</span>How do virtual functions work?</p>
<p>A v-table is constructed for each class that has virtual members.<br />
V-table contains addresses of all virtual functions, and is created when a class is instantiated.</p>
<p>6)<span class="Apple-tab-span" style="white-space: pre;">	</span>Is it possible to have a virtual constructor?</p>
<p>No, because the v-table is not yet available when the constructor is executed.</p>
<p>7)<span class="Apple-tab-span" style="white-space: pre;">	</span>What data structures would you use to store a dictionary of names?<br />
8)<span class="Apple-tab-span" style="white-space: pre;">	</span>What is template metaprogramming?</p>
<p>Metaprogramming is the ability of a program to manipulate other programs as data.<br />
Metaprogramming is frequently achieved via reflection or templates.</p>
<p>Here is an example of metaprogramming in C++:</p>
<p><code><br />
template &lt;int N&gt;<br />
struct Factorial<br />
{<br />
&nbsp; &nbsp; enum { value = N * Factorial&lt;N - 1&gt;::value };<br />
};</p>
<p>template &lt;&gt;<br />
struct Factorial&lt;0&gt;<br />
{<br />
&nbsp; &nbsp; enum { value = 1 };<br />
};</p>
<p>void fact()<br />
{<br />
&nbsp; &nbsp; int x = Factorial&lt;4&gt;::value; // == 24<br />
&nbsp; &nbsp; int y = Factorial&lt;0&gt;::value; // == 1<br />
}<br />
</code></p>
<p>9)<span class="Apple-tab-span" style="white-space: pre;">	</span>Is there a performance difference between a) and b) loops?</p>
<p>a.<span class="Apple-tab-span" style="white-space: pre;">	</span>for (unsigned int i=0; i&lt;10; i++)<br />
b.<span class="Apple-tab-span" style="white-space: pre;">	</span>for (unsigned int i=0; i&lt;10; ++i)</p>
<p>10)<span class="Apple-tab-span" style="white-space: pre;">	</span>Define a Singleton</p>
<p><code><br />
class Singleton<br />
{<br />
public:<br />
&nbsp; &nbsp; static Singleton *instance (void)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (instance_ == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Critical section.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; instance_ = new Singleton;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return instance_;<br />
&nbsp; &nbsp; }<br />
private:<br />
&nbsp; &nbsp; static Singleton *instance_;<br />
};<br />
</code></p>
<div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/ts-interview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auditude interview questions</title>
		<link>http://www.informixoncampus.org/auditude-interview-questions/</link>
		<comments>http://www.informixoncampus.org/auditude-interview-questions/#comments</comments>
		<pubDate>Fri, 04 Jan 2013 11:26:39 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/auditude-interview-questions/</guid>
		<description><![CDATA[http://www.auditude.com/ Auditude is an online video advertising technology and monetization partner for premium content owners and distributors. A recruiter contacted me and scheduled a phone interview with one of the managers.&#160;The interview was not technical and consisted of typical HR questions. Why are you looking for a new position? What are you doing at your [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/auditude-interview-questions/'/><div dir="ltr" style="text-align: left;" trbidi="on">
<div>http://www.auditude.com/</div>
<div>Auditude is an online video advertising technology and monetization partner for premium content owners and distributors.</p>
</div>
<div>A recruiter contacted me and scheduled a phone interview with one of the managers.&nbsp;The interview was not technical and consisted of typical HR questions. Why are you looking for a new position? What are you doing at your current position?&nbsp;At the end of the interview an on-site interview was scheduled.</div>
<div>
</div>
<div>The office was a typical open-space dot com office – nothing fancy.<br />
Three engineers interviewed me and asked the following&nbsp;questions:</p>
</div>
<div></div>
<div>1) &nbsp; &nbsp; &nbsp;Given the following table:</p>
<table>
<tbody>
<tr>
<td>user_id</td>
<td>lab_id</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>3</td>
</tr>
<tr>
<td>5</td>
<td>3</td>
</tr>
<tr>
<td>6</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>5</td>
<td>3</td>
</tr>
<tr>
<td>6</td>
<td>2</td>
</tr>
<tr>
<td>6</td>
<td>1</td>
</tr>
<tr>
<td>6</td>
<td>4</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
</tr>
</tbody>
</table>
</div>
<div><b><br />
</b><br />
<b>For each user find the number of unique visits for each lab.</b></div>
<p><code><br />
</code></p>
<div><code>SELECT</code></div>
<div><code>&nbsp; user_id,</code></div>
<div><code>&nbsp; count(distinct lab_id) number_of_unique_visits</code></div>
<div><code>FROM tst</code></div>
<div><code>GROUP BY user_id;</code><br />
<code><br />
</code></div>
<div></div>
<div><b>For each user find the number of times he visited each lab</b>.</div>
<p><code><br />
</code></p>
<div><code>SELECT</code></div>
<div><code>&nbsp; user_id,</code></div>
<div><code>&nbsp; lab_id,</code></div>
<div><code>&nbsp; count(*) AS number_of_visits</code></div>
<div></div>
<div><code>FROM tst</code></div>
<div><code>GROUP BY user_id, lab_id;</code><br />
<span class="Apple-style-span" style="font-family: monospace;"><br />
</span></div>
<div></div>
<div><b>For each user find the most visited lab.</b></div>
<div><code><br />
SELECT</code></div>
<div><code>&nbsp; t1.user_id,</code></div>
<div><code>&nbsp; (SELECT t2.lab_id FROM tst t2 WHERE t2.user_id = t1.user_id GROUP BY t2.user_id, t2.lab_id ORDER BY count(*) DESC LIMIT 1) most_visited_lab</code></div>
<div><code>FROM tst t1</code></div>
<div><code>GROUP BY t1.user_id;</code></div>
<p></p>
<div></div>
<div>2) &nbsp; &nbsp; &nbsp;In PHP, what is the difference between $objt and $$ objt?</p>
</div>
<div>3) &nbsp; &nbsp; &nbsp;Design a simple database for an online store.</p>
</div>
<div>4) &nbsp; &nbsp; &nbsp;Based on the database design, write a statement to select all orders that contain at least 5 products (i.e. the total quantity of items ordered is greater or equal to five).</p>
</div>
<div>5) &nbsp; &nbsp; &nbsp;Based on the database design, write a statement to select all orders that contain at least 5 different products (i.e. the quantity of each item ordered is not important).</p>
</div>
<div>6) &nbsp; &nbsp; &nbsp;Difference between UNION and UNION ALL in MySQL</p>
</div>
<div>7)<span class="Apple-tab-span" style="white-space: pre;"> </span>You are given a sorted array with shifted elements. Elements can be shifted to the left or right by some number of places. Write code to find if a given number N is present in this array. http://crackinterview.wordpress.com/2010/08/20/find-an-item-in-a-sorted-array-with-shifted-elements/</p>
<p>I usually try not to be judgmental because I only get interviewed to write this blog, but the unfortunate truth is that there are so many jerks in dot-com companies that there are times that it is just impossible to stay imperturbable.<br />
The first interviewer was a typical PHP developer who had no idea about MySQL internals but thought he ruled the world, and could easily optimize any SQL query.<br />
The third interviewer who introduced herself as a chief scientist that does not bother to write any code (yes, she emphasized that) spoke English so badly that it took me 30 minutes to understand her question.<br />
And in the middle of me trying to understand what she was actually trying to say, she simply walked out of the room because she had an urgent call &#8211; well, she is the chief genius there.</p>
<div>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/auditude-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keep your secrets away</title>
		<link>http://www.informixoncampus.org/keep-your-secrets-away/</link>
		<comments>http://www.informixoncampus.org/keep-your-secrets-away/#comments</comments>
		<pubDate>Thu, 03 Jan 2013 11:44:11 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/keep-your-secrets-away/</guid>
		<description><![CDATA[Never tell a recruiter (or your potential employer) your current salary or salary requirements.&#160;Recruiters will pressure you into revealing your current salary because it saves them money but do not give up and if they persist tell them that even your wife does not know the number.&#160;If the recruiter is not in a joking mood [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/keep-your-secrets-away/'/><div class="MsoNormal"></div>
<div class="MsoNormal"></div>
<div class="MsoNormal">Never tell a recruiter (or your potential employer) your current salary or salary requirements.&nbsp;Recruiters will pressure you into revealing your current salary because it saves them money but do not give up and if they persist tell them that even your wife does not know the number.&nbsp;If the recruiter is not in a joking mood you can always claim that your salary requirements are flexible.</p>
</div>
<div class="MsoNormal">Here is why you should never talk about money before you get an offer!</p>
</div>
<div class="MsoNormal">Imagine, you go through all the technical interviews and the company decides that they want to hire you, and they know that your current salary is 60K.&nbsp;So even if the budget for this position was 90K, guess, how much will they offer you? That is right, 5 to 20 percent increase to your current salary is all you can hope for.&nbsp;Furthermore, smart recruiters, if they see you like the job, will, at least initially, offer you less than what you earn now citing hard-times and large unemployment numbers.</p>
</div>
<div class="MsoNormal">On the other hand if you told them that your salary was 120K they might not even have invited you for the interviews on the first place. So you lost a pleasure (experience) of being interviewed and any chance of being hired.</p>
</div>
<div class="MsoNormal">Of course, they might not like you being stubborn and proceed with more&nbsp;agreeable&nbsp;candidates &nbsp;but seriously do you want to work for such a company?&nbsp;In fact, if you do not give up and do not reveal your salary they will probably appreciate your persistence and will respect you.</div>
<div class="MsoNormal">So NEVER tell you salary to ANYONE, not even your girlfriend! ))</div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/keep-your-secrets-away/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Interview Questions</title>
		<link>http://www.informixoncampus.org/c-interview-questions/</link>
		<comments>http://www.informixoncampus.org/c-interview-questions/#comments</comments>
		<pubDate>Wed, 02 Jan 2013 11:39:27 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/c-interview-questions/</guid>
		<description><![CDATA[For some reason, majority of C# .Net phone screenings ask, over and over again, the same meaningless questions. In my opinion, no self-respecting company, should make any decision based on these questions. Anyway, the reality is that you either hire or get hired. So I created a list of questions that helps me to ace [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/c-interview-questions/'/><div dir="ltr" style="text-align: left;" trbidi="on">For some reason, majority of C# .Net phone screenings ask, over and over again, the same meaningless questions. In my opinion, no self-respecting company, should make any decision based on these questions. Anyway, the reality is that you either hire or get hired. So I created a list of questions that helps me to ace phone screenings:</p>
<div>
</div>
<div>
<div>The only difference between executable and library assembly is that library assembly does not contain main entry point.</div>
<div>All assemblies contain metadata that describes its types and methods.</div>
<div>Assemblies also contain manifest (assembly metadata) that describes assembly itself (version and so on).</div>
<div>All private assemblies are located in the same folder (or its subfolders) as the main executable assembly. Shared assemblies are located in the GAC folder.</div>
<div>
</div>
<div>Anonymous type is a nameless class that inherits from object.</div>
<div>For instance: var person = new {firstName = “Me”, lastName = “You”};</div>
<div>
</div>
<div>Structs unlike Classes are value type (not reference type and are being stored in the stack and not on the heap) and do not support inheritance.</div>
<div>
</div>
<div>Extension methods are a simple way to extend classes that do not have source code available. All you have to do is to create a new class that contains a function that has the class you want to extend as a first parameter, preceded by this keyword.</div>
<div>
</div>
<div>Sealed classes cannot be inherited from.</div>
<div>
</div>
<div>Virtual methods can be overridden by derived classes(derived classes use override keyword for safety reasons &#8211; in case you did not notice that the method does not have exactly the same signature as the virtual method you will get an error).</div>
<div>
</div>
<div>Internal visibility modifier makes the class visible only to containing assembly.</div>
<div></div>
<div>Interfaces contain only public methods – no protected, private, or even abstract or static. Interfaces can inherit from each other though.</div>
<div>
</div>
<div>foreach loop can only be used with classes that either implement IEnumerable interface or implement GetEnumerator, MoveNext, (Reset), and Current members.</div>
<div>
</div>
<div>Use checked block to enable overflow cheking.</div>
<div>
</div>
<div>Boxing converts value types to reference types.</div>
</div>
<div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/c-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inside Track</title>
		<link>http://www.informixoncampus.org/inside-track/</link>
		<comments>http://www.informixoncampus.org/inside-track/#comments</comments>
		<pubDate>Tue, 01 Jan 2013 11:09:01 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/inside-track/</guid>
		<description><![CDATA[http://www.insidetrack.com/ A recruiter from the company contacted me and asked the following questions: What is a standard Microsoft technology stack for a database driven web application with reporting? What are C# generics and why they are useful? What are Lambda expressions and what have they replaced? What is LINQ used for and how does this [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/inside-track/'/><div dir="ltr" style="text-align: left;" trbidi="on">http://www.insidetrack.com/<br />
A recruiter from the company contacted me and asked the following questions:</p>
<ol style="text-align: left;">
<li>What is a standard Microsoft technology stack for a database driven web application with reporting?</li>
<li>What are C# generics and why they are useful?</li>
<li>What are Lambda expressions and what have they replaced?</li>
<li>What is LINQ used for and how does this benefit the programmer?</li>
<li>What are CURSOR in T-SQL and how can they be helpful?</li>
</ol>
<div style="text-align: left;">
</div>
<ol style="text-align: left;">
<li>ADO and also Microsoft Reporting Services are used for DB driven web applications with reporting.</li>
<li>Generics are similar to templates in C++. Generics allow to defer specifications of types until class/method is declared/instantiated.</li>
<li>Lambda expressions replaced anonymous methods syntax that allow to declare code inline</li>
<li>LINQ is Language Integrated Query &#8211; it transforms database development model into an object oriented one so the developer who know OOP does not have to go deep into SQL.</li>
<li>CURSOR allows to loop through data &#8211; row by row.</li>
</ol>
<div style="text-align: left;">
An on-site interview was scheduled:</p>
<p>1) You have 2 tables: Student and StudentTmp<br />
a.&nbsp;&nbsp;&nbsp; StudentTmp contains exactly the same fields (StudentID, Name, DateCreated, DateUpdated) as Student<br />
b.&nbsp;&nbsp;&nbsp; Write a stored procedure (SQL) that copies data from StudentTmp to Student, if the data is not already there (i.e. StudentID does not exist) and updates it otherwise</p>
<p>2) You have Coaches that coach Students that attend a School and Managers that manage coaches.<br />
a.&nbsp;&nbsp;&nbsp; Each manager can manage many coaches<br />
b.&nbsp;&nbsp;&nbsp; Each Student attends exactly one schools<br />
c.&nbsp;&nbsp;&nbsp; Each coach can coach many students<br />
d.&nbsp;&nbsp;&nbsp; Each student can be only coached by exactly one coach each semester.<br />
Create a DB schema that implements it.</p>
<p>3) Design classes to for a chess game<br />
4)&nbsp; Design a database schema for a basketball game<br />
5)&nbsp; All the language&nbsp; crap (i.e. virtual, const, public, inheritance, OOP, sort, data structures)<br />
Inside </div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/inside-track/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sportvision</title>
		<link>http://www.informixoncampus.org/sportvision/</link>
		<comments>http://www.informixoncampus.org/sportvision/#comments</comments>
		<pubDate>Mon, 31 Dec 2012 11:42:23 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/sportvision/</guid>
		<description><![CDATA[http://www.sportvision.com/ 1) You have a nxn matrix that contains integers only. a.&#160;&#160;&#160; The numbers always increase to the right and to the bottom b.&#160;&#160;&#160; What is the fastest way to find a number x (you know it is in the matrix) 2) 4 people must cross a bridge. a.&#160;&#160;&#160; Only 2 people can walk a [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/sportvision/'/><div dir="ltr" style="text-align: left;" trbidi="on">http://www.sportvision.com/<br />
1) You have a nxn matrix that contains integers only.<br />
a.&nbsp;&nbsp;&nbsp; The numbers always increase to the right and to the bottom<br />
b.&nbsp;&nbsp;&nbsp; What is the fastest way to find a number x (you know it is in the matrix)</p>
<p>2) 4 people must cross a bridge.<br />
a.&nbsp;&nbsp;&nbsp; Only 2 people can walk a bridge at the same time because it is dark and they have to carry a flashlight with them.<br />
b.&nbsp;&nbsp;&nbsp; Once 2 people cross the bridge one of them must return the flashlight so that the rest can cross it<br />
i.&nbsp;&nbsp;&nbsp; First person can cross the bridge in 10 minutes<br />
ii.&nbsp;&nbsp;&nbsp; Second in&nbsp; 5 minutes<br />
iii.&nbsp;&nbsp;&nbsp; Third in 2 minutes<br />
iv.&nbsp;&nbsp;&nbsp; Fourth in 1 minutes<br />
How long will it take them all to cross the bridge?<br />
They are in hurry and must do it as fast as possible</p>
<p>3) Write an algorithm to convert integers to words.<br />
a.&nbsp;&nbsp;&nbsp; i.e. 1234 must be spelled as one thousand thirty four</p>
<p>4) Write an algorithm to reverse a single-linked list</p>
<p>5) Write an algorithm to draw a star with n corners<br />
a.&nbsp;&nbsp;&nbsp; You have 2 functions to use: moveto(x,y) lineto(x,y)</p>
<p>6) Write an algorithm to add a node to a singly-linked list<br />
&nbsp;&nbsp;&nbsp; <br />
7) You have a table A that contains managers with their ManagerID and Name and table B that contains employees with their EmployeeID, Name, and reference to their manager (ManagerID).<br />
a.&nbsp;&nbsp;&nbsp; Write a SQL statement to display all Employee names with their manager names.<br />
b.&nbsp;&nbsp;&nbsp; Modify the statement to display employees that do not have a matching manager</p>
<p>8) You have a b-tree How would you store it in a relational database? (Design the schema)
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/sportvision/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google interview questions</title>
		<link>http://www.informixoncampus.org/google-interview-questions/</link>
		<comments>http://www.informixoncampus.org/google-interview-questions/#comments</comments>
		<pubDate>Sun, 30 Dec 2012 10:56:18 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/google-interview-questions/</guid>
		<description><![CDATA[http://www.google.com/ I was interviewed for a Software Reliability Engineer position. A recruiter from Google contacted and asked if I want to have an interview with a Google engineer, It is hard to say no to Google; after all, in terms of benefits, working for Google is the second best thing after having your own business. [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/google-interview-questions/'/><div dir="ltr" style="text-align: left;" trbidi="on">http://www.google.com/<br />
I was interviewed for a Software Reliability Engineer position.</p>
<p>A recruiter from Google contacted and asked if I want to have an interview with a Google engineer,<br />
It is hard to say no to Google; after all, in terms of benefits, working for Google is the second best thing after having your own business.</p>
<p>Two weeks have passed and no word from Goggle.<br />
Well, I thought, they have so many candidates that have probably forgotten about me.<br />
But in another week, I received an e-mail from the same recruiter asking to select your top three areas of my developmental expertise.<br />
1) Web applications and multi-tiered systems<br />
2) Database internals<br />
3) Windows development<br />
And she also asked me if I know someone who already works for Google. I found two references (in retrospective should have said no).<br />
In a week another recruiter contacted me and asked to rate myself:<br />
&nbsp;&nbsp; 0 &#8211; Indicates you have NO EXPERIENCE &#8211; that is fine but please indicate<br />
1-3 &#8211; Indicates you can read / understand the subject area, but would not be comfortable implementing anything in it.<br />
4-6 &#8211; Indicates you are comfortable with the subject area and all normal / routine work in it.<br />
&nbsp;&nbsp; 7 &#8211; Indicates that you are extremely proficient and have deep technical expertise in the subject.&nbsp; You would be comfortable with personally designing and implementing any project in that area.<br />
&nbsp;&nbsp; 8 &#8211; Indicates that you are almost an expert from fundamentals to advanced concepts. <br />
&nbsp;&nbsp; 9 &#8211; Indicates you are an expert and could have written a book on the subject, but didn&#8217;t.<br />
&nbsp;10 &#8211; Reserved for those who are recognized industry experts in a field (i.e. wrote a book on the subject).</p>
<p>3 TCP/IP Networking (OSI stack, DNS etc)<br />
3 Unix/Linux internals<br />
6 Unix/Linux Systems administration<br />
6 Algorithms &amp; Data Structures<br />
5 C<br />
8 C++<br />
0 Python<br />
4 Java<br />
4 Perl<br />
6 Shell Scripting (sh, Bash, ksh, csh)<br />
8 SQL and/or Database Admin<br />
4 Management</p>
<p>In a couple of days the second recruiter scheduled a phone interview with him for the following week.<br />
Five minutes before the scheduled interview I received and e-mail from the recruiter saying that he has an emergency meeting and would like to reschedule the interview for the next week.<br />
Next week he called and asked some questions:</p>
<ol style="text-align: left;">
<li>Convert a number from decimal to binary.</li>
<li>Describe some basic data structures.</li>
<li>Describe some basic search algorithms.</li>
</ol>
<div style="text-align: left;">And then he continued talking on the importance of Software Reliability Engineers.<br />
In two weeks he scheduled a phone interview for me with a Google engineer.<br />
The interview was conducted using Google online documents so that the interviewer could see me type the code.<br />
She asked just one question:</p>
<p>1)&nbsp;&nbsp; &nbsp;We have two bishops on a chess board. The board has 64 squares and each square is numbered 1 through 64.The bishop has no restrictions in distance for each move, but is limited to diagonal movement.<br />
a.&nbsp;&nbsp; &nbsp;Write a function that given position of the two bishops (a number between 1 and 64) returns minimum number of turns required for the bishops to meet. Return -1 if no solution found. For example, for bishops located at postions 10 and 26 the function should return 2.<br />
The problem is really hard to solve if we stick with 1 through 64 numbering but ones we switch to x and y coordinates the solution is trivial.<br />
The interviewer was very nice and helpful.</p>
<p>Next day I received an e-mail for the recruiter saying that they were “impressed with my problem solving skills” and would like to schedule a second phone interview.<br />
This time the subject would be Linux. The interview was scheduled for the next week.<br />
My Linux skills are a little bit rusty so the next weekend I ended up reading Linux books,<br />
The second engineer who called me was not as nice as the first, and just by talking to him for the first two minutes put me in a panic mode.<br />
He asked me two questions and none of them was related to Linux:</p>
<p>1)&nbsp;&nbsp; &nbsp;Explain Insertion, Heap, and Quick sort.<br />
2)&nbsp;&nbsp; &nbsp;Given two words that contain the same number of characters find the fastest way to transform word one into word two by changing one letter a time. All the transitional words must be valid words from a dictionary.<br />
a.&nbsp;&nbsp; &nbsp;For instance transform cat to bet: cat-bat-bet</p>
<p>With some help for the interviewer I figured out that a graph that connects each word to all the words from the dictionary that differ by one letter must be built, and then Dijkstra can be run on it to determine the shortest path.<br />
And then he asked me, what is the complexity of Dijkstra algorithm? To my surprise I completely forgot its complexity, after all the last time I used it was ten years ago.<br />
The next thirty minutes I was deducing the complexity of Dijkstra algorithm and with some help from the guy I solved the problem O(EN).<br />
I could have easily checked the complexity online but I was curious to solve it by myself, and I also wanted to be fair.<br />
The guy thanked me and in three weeks I received a rejection letter from Google.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/google-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tagged interview questions</title>
		<link>http://www.informixoncampus.org/tagged-interview-questions/</link>
		<comments>http://www.informixoncampus.org/tagged-interview-questions/#comments</comments>
		<pubDate>Sat, 29 Dec 2012 10:53:07 +0000</pubDate>
		<dc:creator>nosfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://informixoncampus.trusted-domains.net/tagged-interview-questions/</guid>
		<description><![CDATA[http://www.tagged.com/ I was interviewed by a recruiter from the company: How many bits needed to represent 1000000? What is the complexity of searching in a balanced binary search tree? What is the complexity of insertion in a hash table? Find two numbers in an array whose sum = X. I must admit I was not [...]]]></description>
			<content:encoded><![CDATA[<input class='jpibfi' type='hidden' data-jpibfi-url='http://www.informixoncampus.org/tagged-interview-questions/'/><div dir="ltr" style="text-align: left;" trbidi="on">http://www.tagged.com/<br />
I was interviewed by a recruiter from the company:</p>
<ol style="text-align: left;">
<li>How many bits needed to represent 1000000?</li>
<li>What is the complexity of searching in a balanced binary search tree?</li>
<li>What is the complexity of insertion in a hash table?</li>
<li>Find two numbers in an array whose sum = X.</li>
</ol>
<div style="text-align: left;">I must admit I was not that excited about what the company does so I was lazy answering some questions.<br />
For instance, for question 1 I explained that we should find solution to 2 to the power of n = 1000000 but did not bother calculating the n.<br />
Also for question 4 I gave the recruiter a better solution than the standard one (two pointers, start and end) but he did not understand it.<br />
I have never heard from them again.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.informixoncampus.org/tagged-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
