<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-2682781734368178743.post284463428017531536..comments</id><updated>2011-07-08T12:27:11.068-07:00</updated><category term='puzzles'/><category term='Questions-List'/><category term='String Manipulation'/><category term='Dynamic Programming'/><category term='Linked List'/><category term='Array'/><category term='Microsoft'/><category term='Databases'/><category term='Data Structures'/><category term='MySpace'/><category term='Tree'/><category term='.NET/C#'/><title type='text'>Comments on Technical Interview Questions, Answers, and Tips: Merge 2 Sorted Arrays (one has empty slots)</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.technicalinterviewquestions.net/feeds/284463428017531536/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default'/><link rel='alternate' type='text/html' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html'/><author><name>avid gardener</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2682781734368178743.post-8690301601417724874</id><published>2011-06-22T00:47:26.026-07:00</published><updated>2011-06-22T00:47:26.026-07:00</updated><title type='text'>// Both the above code doesn&amp;#39;t work and produc...</title><summary type='text'>// Both the above code doesn&amp;#39;t work and produces invalid result. Here is the correct code and works perfectly for the above example.&lt;br /&gt;&lt;br /&gt;        void mergeArray(int[] A1, int[] A2)&lt;br /&gt;        {&lt;br /&gt;            int count = FindCount(A2); // get the count of full slots&lt;br /&gt;            int i = A1.Length - 1;&lt;br /&gt;            int j = count - 1;&lt;br /&gt;            int k = A2.Length - 1;&lt;</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/8690301601417724874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/8690301601417724874'/><link rel='alternate' type='text/html' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html?showComment=1308728846026#c8690301601417724874' title=''/><author><name>thiruv</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html' ref='tag:blogger.com,1999:blog-2682781734368178743.post-284463428017531536' source='http://www.blogger.com/feeds/2682781734368178743/posts/default/284463428017531536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-274797178'/></entry><entry><id>tag:blogger.com,1999:blog-2682781734368178743.post-4559313778383969687</id><published>2010-09-08T05:29:15.840-07:00</published><updated>2010-09-08T05:29:15.840-07:00</updated><title type='text'>void Merge(int[] A1, int[] A2)
{
   int count = Fi...</title><summary type='text'>void Merge(int[] A1, int[] A2)&lt;br /&gt;{&lt;br /&gt;   int count = FindCount(A2); // get the count of full slots&lt;br /&gt;   int i = A1.Length - 1;&lt;br /&gt;   int j = count - 1;&lt;br /&gt;   int k = A2.Length - 1;&lt;br /&gt;&lt;br /&gt;   for(;k&amp;gt;=0;k--)&lt;br /&gt;   {&lt;br /&gt;      if(A1[i] &amp;gt; A2[j] || j &amp;lt; 0)&lt;br /&gt;      {&lt;br /&gt;         A2[k] =A1[i];&lt;br /&gt;         i--;&lt;br /&gt;         if(i&amp;lt;0)&lt;br /&gt;         break;&lt;br /&gt;      }&lt;</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/4559313778383969687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/4559313778383969687'/><link rel='alternate' type='text/html' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html?showComment=1283948955840#c4559313778383969687' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html' ref='tag:blogger.com,1999:blog-2682781734368178743.post-284463428017531536' source='http://www.blogger.com/feeds/2682781734368178743/posts/default/284463428017531536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-124133505'/></entry><entry><id>tag:blogger.com,1999:blog-2682781734368178743.post-3041864421046906245</id><published>2010-08-12T08:09:56.498-07:00</published><updated>2010-08-12T08:09:56.498-07:00</updated><title type='text'>void merge(int[] A1, int[] A2)
{
   int count = fi...</title><summary type='text'>void merge(int[] A1, int[] A2)&lt;br /&gt;{&lt;br /&gt;   int count = findCount(A2); // get the count of full slots&lt;br /&gt;   int i = A1.length - 1;&lt;br /&gt;   int j = count - 1;&lt;br /&gt;   int k = A2.length - 1;&lt;br /&gt;&lt;br /&gt;   for(;k&amp;gt;=0;k--)&lt;br /&gt;   {&lt;br /&gt;      if((i &amp;gt;= 0 &amp;amp;&amp;amp; j &amp;gt;= 0 &amp;amp;&amp;amp; A1[i] &amp;gt; A2[j]) || j &amp;lt; 0)&lt;br /&gt;      {&lt;br /&gt;         A2[k] =A1[i];&lt;br /&gt;         i--;&lt;br /&gt;      }&lt;br </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/3041864421046906245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/3041864421046906245'/><link rel='alternate' type='text/html' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html?showComment=1281625796498#c3041864421046906245' title=''/><author><name>Bipin Jethwani</name><uri>http://www.blogger.com/profile/16544987540436372739</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html' ref='tag:blogger.com,1999:blog-2682781734368178743.post-284463428017531536' source='http://www.blogger.com/feeds/2682781734368178743/posts/default/284463428017531536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1303997271'/></entry><entry><id>tag:blogger.com,1999:blog-2682781734368178743.post-8550550805530466547</id><published>2010-01-21T18:37:37.437-08:00</published><updated>2010-01-21T18:37:37.437-08:00</updated><title type='text'>Have you tried running this code ? I think it will...</title><summary type='text'>Have you tried running this code ? I think it will give ArrayIndexOutofBounds (or similar exception) on line:&lt;br /&gt;if(A1[i] &amp;gt; A2[j] || j &amp;lt; 0)</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/8550550805530466547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/8550550805530466547'/><link rel='alternate' type='text/html' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html?showComment=1264127857437#c8550550805530466547' title=''/><author><name>geek</name><uri>http://techpuzzl.wordpress.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html' ref='tag:blogger.com,1999:blog-2682781734368178743.post-284463428017531536' source='http://www.blogger.com/feeds/2682781734368178743/posts/default/284463428017531536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1649421142'/></entry><entry><id>tag:blogger.com,1999:blog-2682781734368178743.post-1359250095874929179</id><published>2009-10-26T19:47:00.885-07:00</published><updated>2009-10-26T19:47:00.885-07:00</updated><title type='text'>thanks for the feedback. I revised the problem des...</title><summary type='text'>thanks for the feedback. I revised the problem description and the solution.</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/1359250095874929179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/1359250095874929179'/><link rel='alternate' type='text/html' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html?showComment=1256611620885#c1359250095874929179' title=''/><author><name>gman</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html' ref='tag:blogger.com,1999:blog-2682781734368178743.post-284463428017531536' source='http://www.blogger.com/feeds/2682781734368178743/posts/default/284463428017531536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-873672406'/></entry><entry><id>tag:blogger.com,1999:blog-2682781734368178743.post-1757604929708451911</id><published>2009-10-25T17:08:53.322-07:00</published><updated>2009-10-25T17:08:53.322-07:00</updated><title type='text'>i think there is a mistake in the index for smalle...</title><summary type='text'>i think there is a mistake in the index for smaller, it should be j instead of i.</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/1757604929708451911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2682781734368178743/284463428017531536/comments/default/1757604929708451911'/><link rel='alternate' type='text/html' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html?showComment=1256515733322#c1757604929708451911' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.technicalinterviewquestions.net/2009/01/merge-sorted-arrays-empty-slots.html' ref='tag:blogger.com,1999:blog-2682781734368178743.post-284463428017531536' source='http://www.blogger.com/feeds/2682781734368178743/posts/default/284463428017531536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-2072023311'/></entry></feed>
