<?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>csTechie</title>
	<atom:link href="http://cstechie.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cstechie.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 08 Mar 2010 05:17:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Print a Square Matrix Spirally &#8211; Java Source Code</title>
		<link>http://cstechie.com/print-a-square-matrix-spirally-java-source-code/</link>
		<comments>http://cstechie.com/print-a-square-matrix-spirally-java-source-code/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 05:17:43 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Java Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=237</guid>
		<description><![CDATA[

   public static void printSpirally(int[][] a) {
        int N = a[0].length;
        for (int i = N - 1, j = 0; i > 0; i--, j++) {
            for [...]]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>
   public static void printSpirally(int[][] a) {
        int N = a[0].length;
        for (int i = N - 1, j = 0; i > 0; i--, j++) {
            for (int k = j; k < i; k++)System.out.println(a[j][k]);
            for (int k = j; k < i; k++)System.out.println(a[k][i]);
            for (int k = i; k > j; k--)System.out.println(a[i][k]);
            for (int k = i; k > j; k--)System.out.println(a[k][j]);
        }
        int middle = (N / 2);
        if ((N % 2) == 1) {
            System.out.println(a[middle][middle]);
        }
    }
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/print-a-square-matrix-spirally-java-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reverse Vowels in a String &#8211; Java Source Code</title>
		<link>http://cstechie.com/reverse-vowels-in-a-string-java-source-code/</link>
		<comments>http://cstechie.com/reverse-vowels-in-a-string-java-source-code/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 16:59:26 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Java Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=231</guid>
		<description><![CDATA[

    public static boolean isVowel(char inp) {
        char c = Character.toUpperCase(inp);

        if ((c == 'A') &#124;&#124; (c == 'E') &#124;&#124; (c == 'I') &#124;&#124; (c == 'O') &#124;&#124; (c == 'U')) {
       [...]]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>
    public static boolean isVowel(char inp) {
        char c = Character.toUpperCase(inp);

        if ((c == 'A') || (c == 'E') || (c == 'I') || (c == 'O') || (c == 'U')) {
            return true;
        }

        return false;
    }

    public static void reverseVowels(char[] a) {
        int start = 0;
        int end = a.length - 1;

        while (start < end) {
            while ((start < a.length) &#038;&#038; !isVowel(a[start])) {
                start++;
            }

            while ((end > 0) &#038;&#038; !isVowel(a[end])) {
                end--;
            }

            if ((start > = end) || (start == a.length) || (end == -1)) {
                return;
            }

            //swap start and end;
            char t = a[start];
            a[start] = a[end];
            a[end] = t;
            start++;
            end--;
        }
    }
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/reverse-vowels-in-a-string-java-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print Binary Search Tree Level By Level &#8211; Java Source Code</title>
		<link>http://cstechie.com/print-binary-search-tree-level-by-level-java-source-code/</link>
		<comments>http://cstechie.com/print-binary-search-tree-level-by-level-java-source-code/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 14:45:56 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=226</guid>
		<description><![CDATA[Print all nodes level by level



   public static void printlevelByLevel(Node root)
   {
      Node current = root;
      Queue q = new Queue();
      q.add(root);
      while(!q.isEmpty())
      {
   [...]]]></description>
			<content:encoded><![CDATA[<p>Print all nodes level by level<br />
<code>
<pre>

   public static void printlevelByLevel(Node root)
   {
      Node current = root;
      Queue q = new Queue();
      q.add(root);
      while(!q.isEmpty())
      {
        Node c =(Node) q.remove();
        System.out.print(c.val+",");
        if(c.left!=null)q.add(c.left);
        if(c.right!=null)q.add(c.right);
      }
   }
</pre>
<p></code></p>
<p>Print all nodes level by level and priting also when each level finishes</p>
<p><code>
<pre>

      public static void printlevelByLevel2Queues(Node root)
   {
      Node current = root;
      Queue q[] = new Queue[]{new Queue(),new Queue()};
      int currentQ=0;
      q[currentQ].add(root);
      while(!q[currentQ].isEmpty() || !q[1-currentQ].isEmpty() )
      {
        if(q[currentQ].isEmpty())
        {
          System.out.println("One level Finished... Switching queue...");
          currentQ = 1- currentQ;
        }
        Node c =(Node) q[currentQ].remove();
        System.out.print(c.val+",");
        if(c.left!=null)q[1-currentQ].add(c.left);
        if(c.right!=null)q[1-currentQ].add(c.right);
      }
   }
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/print-binary-search-tree-level-by-level-java-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Card Shuffle &#8211; Java Source Code</title>
		<link>http://cstechie.com/card-shuffle-java-source-code/</link>
		<comments>http://cstechie.com/card-shuffle-java-source-code/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 06:05:07 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Java Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=222</guid>
		<description><![CDATA[


  public static void shuffle(int[] a)
  {
    int N = a.length;
    Random r = new Random(new Date().getTime());
    for (int i = 0; i < a.length-1; i++)
    {
       int tmp=0;
       [...]]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>

  public static void shuffle(int[] a)
  {
    int N = a.length;
    Random r = new Random(new Date().getTime());
    for (int i = 0; i < a.length-1; i++)
    {
       int tmp=0;
       // Find a random element from i to N-1
       int randElem = i + r.nextInt(N-i);
       //Replace randElem with current element
       tmp = a[i];a[i]=a[randElem];a[randElem]=tmp;
    }
  }
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/card-shuffle-java-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find 2 Elements in a Sorted Array with a given Sum &#8211; Java Source Code</title>
		<link>http://cstechie.com/find-2-elements-in-a-sorted-array-with-a-given-sum-java-source-code/</link>
		<comments>http://cstechie.com/find-2-elements-in-a-sorted-array-with-a-given-sum-java-source-code/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 03:34:30 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Java Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=220</guid>
		<description><![CDATA[Find if the sum of two elements in a sorted array sum up to b (a number) with complexity of O(n).


  public static void find2ElementsOfSum(int[] a,int S)
  {
    int left = 0;
    int right = a.length-1;
    while(left < right)
    {
  [...]]]></description>
			<content:encoded><![CDATA[<p>Find if the sum of two elements in a sorted array sum up to b (a number) with complexity of O(n).<br />
<code>
<pre>
  public static void find2ElementsOfSum(int[] a,int S)
  {
    int left = 0;
    int right = a.length-1;
    while(left < right)
    {
      int sum = a[left]+a[right];
      System.out.println("current Sum="+sum);
      if(sum==S){
       System.out.println("FOUND left="+left+" rigt="+right);
       return;
      }
      if(sum < S)
      {
        left++;
      }else
      {
        right--;
      }
    }
    System.out.println("NOT FOUND");
  }
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/find-2-elements-in-a-sorted-array-with-a-given-sum-java-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maximum SubArray Sum &#8211; Java Source Code</title>
		<link>http://cstechie.com/maximum-subarray-sum-java-source-code/</link>
		<comments>http://cstechie.com/maximum-subarray-sum-java-source-code/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 12:43:10 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Java Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=216</guid>
		<description><![CDATA[Given an array of positive and negative numbers. Find the contiguous sub array of maximum sum.


   public static void subArraySum(int a[])
  {
    int i=0;
    int j=0;
    int start=0;
    int end=0;
    int maxSum = -99999;
    [...]]]></description>
			<content:encoded><![CDATA[<p>Given an array of positive and negative numbers. Find the contiguous sub array of maximum sum.<br />
<code></p>
<pre>
   public static void subArraySum(int a[])
  {
    int i=0;
    int j=0;
    int start=0;
    int end=0;
    int maxSum = -99999;
    int cSum = 0;
    while(j < a.length)
    {
       cSum +=a[j];
       if(cSum>maxSum)// Set this as the new result
       {
          start=i;
          end = j;
          maxSum=cSum;
       }else if(cSum < 0)
       {
         cSum=0;
         i=j+1;
       }
       j++;
    }
    System.out.println("start="+start+" end="+end+" maxSum="+maxSum);

  }
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/maximum-subarray-sum-java-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binary Search &#8211; Java Source Code Snippet</title>
		<link>http://cstechie.com/binary-search-java-source-code-snippet/</link>
		<comments>http://cstechie.com/binary-search-java-source-code-snippet/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 04:28:46 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Java Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=213</guid>
		<description><![CDATA[


  public static int binarySearch(int a[],int s)
  {
     int N = a.length;
     int start=0;
     int end = N-1;
     while(start  s)
        {
         [...]]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>

  public static int binarySearch(int a[],int s)
  {
     int N = a.length;
     int start=0;
     int end = N-1;
     while(start <= end)
     {
        int mid = start+(end-start)/2;
        if(a[mid] > s)
        {
          end=mid-1;
        }else if(a[mid] < s)
        {
          start=mid+1;
        }else
        {
          return mid;
        }
     }
     return -(start+1);
  }
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/binary-search-java-source-code-snippet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Insertion Sort &#8211; Java Source Code Snippet</title>
		<link>http://cstechie.com/insertion-sort-java-source-code-snippet/</link>
		<comments>http://cstechie.com/insertion-sort-java-source-code-snippet/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 17:17:09 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Algorithms]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=210</guid>
		<description><![CDATA[

  public static void sort(int[] a)
  {
    for (int i = 1; i < a.length; i++)
    {
       int current_val= a[i];
       int j= i;
       while(j > 0 &#038;&#038; a[j-1] > [...]]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>
  public static void sort(int[] a)
  {
    for (int i = 1; i < a.length; i++)
    {
       int current_val= a[i];
       int j= i;
       while(j > 0 &#038;&#038; a[j-1] > current_val)
       {
          a[j]=a[j-1];
          j--;
       }
       a[j]=current_val;

    }

  }
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/insertion-sort-java-source-code-snippet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to send Invite/Request from your facebook iframe application to all your friends in 10 minutes</title>
		<link>http://cstechie.com/how-to-send-inviterequest-from-your-facebook-iframe-application-to-all-your-friends-in-10-minutes/</link>
		<comments>http://cstechie.com/how-to-send-inviterequest-from-your-facebook-iframe-application-to-all-your-friends-in-10-minutes/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 06:30:16 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Code Examples]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=203</guid>
		<description><![CDATA[Creating an invitation/request page from an iframe application page is fairly easy, but I could not find a single place with all the required steps. So thought of noting it down for my own and others use.
1. From the applications settings page(Advanced Settings) disable the Sandbox mode
2. You need to enable Communication Between Your Site [...]]]></description>
			<content:encoded><![CDATA[<p>Creating an invitation/request page from an iframe application page is fairly easy, but I could not find a single place with all the required steps. So thought of noting it down for my own and others use.</p>
<p>1. From the applications settings page(Advanced Settings) disable the Sandbox mode</p>
<p>2. You need to enable Communication Between Your Site and Facebook as per the following document :<br />
http://wiki.developers.facebook.com/index.php/Connect/Setting_Up_Your_Site</p>
<p>3. You need to set Connect URL. This is an unnecessary looking but a very important step, even if you do not have a facebook connect site.</p>
<p>4. Finally the code :<br />
<code> </code></p>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"&gt;
&lt;body&gt;
&lt;script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
FB.init("&lt;APPLICATION KEY&gt;", "fb/xd_receiver.htm");
&lt;/script&gt;
&lt;fb:serverFbml style="width: 755px;"&gt;
    &lt;script type="text/fbml"&gt;
      &lt;fb:fbml&gt;
          &lt;fb:request-form
                    action="http://www.edostee.com/fb/"
                    method="POST"
                    invite="false"
                    type="&lt;APPLICATION NAME&gt;"
                    content="REQUEST CONTENT &lt;a href='http://apps.facebook.com/edostee/'&gt;eDostee&lt;/a&gt; - fastest growing and brand new Indian Dating application
                 &lt;fb:req-choice url='http://apps.facebook.com/edostee'
                       label='Join eDostee' /&gt;
              "
              &gt;
                    &lt;fb:multi-friend-selector
                    showborder="false"
                    actiontext="Invite your friends to join eDostee."&gt;
        &lt;/fb:request-form&gt;
      &lt;/fb:fbml&gt;

    &lt;/script&gt;
  &lt;/fb:serverFbml&gt;
  &lt;/body&gt;
  &lt;/html&gt;</pre>
<p>Above page will be rendered as below</p>
<p><img src="http://cstechie.com/wp-content/uploads/2010/02/inivtes.JPG" /></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/how-to-send-inviterequest-from-your-facebook-iframe-application-to-all-your-friends-in-10-minutes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle SQL Snippet : Find Definition of a View</title>
		<link>http://cstechie.com/oracle-sql-snippet-find-definition-of-a-view/</link>
		<comments>http://cstechie.com/oracle-sql-snippet-find-definition-of-a-view/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 07:48:25 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Oracle SQL]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=201</guid>
		<description><![CDATA[To find the definition of view SYS.ALL_TABLES use the following SQL code

select TEXT
    from DBA_VIEWS
    where OWNER = 'SYS'
    and VIEW_NAME  = 'ALL_TABLES'

]]></description>
			<content:encoded><![CDATA[<p>To find the definition of view SYS.ALL_TABLES use the following SQL code</p>
<pre>
<code>select TEXT
    from DBA_VIEWS
    where OWNER = 'SYS'
    and VIEW_NAME  = 'ALL_TABLES'</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/oracle-sql-snippet-find-definition-of-a-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
