<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>srm &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/srm/</link>
	<description>Feed of posts on WordPress.com tagged "srm"</description>
	<pubDate>Thu, 23 May 2013 04:28:04 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Google Code Jam ´13 Round 1A Problem C Good Luck]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/27/google-code-jam-13-round-1a-problem-c-good-luck/</link>
<pubDate>Sat, 27 Apr 2013 07:37:05 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/27/google-code-jam-13-round-1a-problem-c-good-luck/</guid>
<description><![CDATA[Hello! I read this problem once&#8230; but i noticed that was above my level, and i focused in Probl]]></description>
<content:encoded><![CDATA[<p>Hello!</p>
<p>I read this problem once&#8230; but i noticed that was above my level, and i focused in Problem B. Reading now&#8230; i notice that i did a good choice, because is a very hard problem.</p>
<p>Only<em> <strong>1366</strong></em> users did it the small. And only <em><strong>31</strong></em> of them did the large one.</p>
<p>If some of you have some idea of this problem, i appreciate some of info, or some approach!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Google Code Jam ´13 Round 1A Problem B Manage your Energy]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/27/google-code-jam-13-round-1a-problem-b-manage-your-energy/</link>
<pubDate>Sat, 27 Apr 2013 07:31:36 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/27/google-code-jam-13-round-1a-problem-b-manage-your-energy/</guid>
<description><![CDATA[Hi, This is the only problem i could try to code, but I couldn´t complete it, i tried and tried, but]]></description>
<content:encoded><![CDATA[<p>Hi, This is the only problem i could try to code, but I couldn´t complete it, i tried and tried, but i don´t know where my code gives me a wrong output. Because it works, but the output is Incorrect.</p>
<p>Maybe i did a totally wrong approach, i don´t know. I needed to change my code at minute 23 when an announcement appeared, and i mean that i add wrong code there.</p>
<p>Only <em><b>2323 </b></em>users did the small, and <em><strong>456</strong> </em>of them did the large one.</p>
<p>Here <strong>my C# code</strong>:</p>
<pre>using System;
using System.Collections.Generic;
using System.IO;

namespace GoogleCodeJam
{
    class Program
    {
        static void Main(string[] args)
        {
            StreamReader sr = new StreamReader(@"C:\B-small-attempt10.in");
            StreamWriter sw = new StreamWriter(@"C:\5.txt");
            string numberTest = sr.ReadLine();
            string[] temp = new string[int.Parse(numberTest) * 2];
            for (int i = 0; i &#60; temp.Length; i++)
                temp[i] = sr.ReadLine();
            int cases = 1;
            int maxEnergy = 0;
            for (int i = 0; i &#60; temp.Length; i += 2)
            {
                string[] temp1 = temp[i].Split(' ');
                string[] temp2 = temp[i + 1].Split(' ');
                maxEnergy = (int.Parse(temp1[1]) &#62; int.Parse(temp1[0])) ? int.Parse(temp1[1]) : int.Parse(temp1[0]);
                int energy = int.Parse(temp1[0]);
                for (int a = 0; a &#60; temp2.Length; a++)
                {
                    if (int.Parse(temp2[a]) == 1)
                    {
                        energy -= maxEnergy;
                        if (a + 1 != temp2.Length)
                            energy += int.Parse(temp1[1]);
                    }
                    else
                    {
                        energy += maxEnergy * int.Parse(temp2[a]);
                    }

                }
                sw.WriteLine("Case #" + cases + ": " + energy.ToString());
                cases++;
            }
            sw.Close();

        }
    }
}</pre>
<p>If you have some clean approach, or you know why my code is wrong, i will be very grateful for your explanation.</p>
<p>Thank you very much for all your help</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Google Code Jam ´13 Round 1A Problem A Bullseye]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/27/google-code-jam-13-round-1a-problem-a-bullseye/</link>
<pubDate>Sat, 27 Apr 2013 07:23:26 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/27/google-code-jam-13-round-1a-problem-a-bullseye/</guid>
<description><![CDATA[Hello.. I tried to do this problem in Round 1A, but i read and read again, and I think that I couldn]]></description>
<content:encoded><![CDATA[<p>Hello..</p>
<p>I tried to do this problem in Round 1A, but i read and read again, and I think that I couldn´t even understand well&#8230;  I will read the analisys when availabe, but until then, if some of you want to explain me, or give me his/her approach, i will be very grateful.</p>
<p>Only <em><strong>5856</strong></em> users did the small, and <em><strong>1806</strong> </em>of them the large one.</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[SRM 577 DIV 2, Problem 250]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/26/srm-578-div-2-problem-250/</link>
<pubDate>Fri, 26 Apr 2013 17:21:39 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/26/srm-578-div-2-problem-250/</guid>
<description><![CDATA[Here a new problem from the SRM 578 DIV 2. Here i decided to in a new string variable, store the new]]></description>
<content:encoded><![CDATA[<p>Here a new problem from the SRM 578 DIV 2.</p>
<p>Here i decided to in a new string variable, store the new letters, then with a for loop, check every leeter in the input, and then, if is a vowel or &#8216;y&#8217;, take only the first one. I do this with a bool variable, when i get the first i put the bool to true, then i only take a new wovel if the bool is false, and i put the bool to false when i add a new consonant. Then when the for loop ends, return the length of the new string as an int.</p>
<p>Here the <strong>problem statement</strong>:</p>
<p>Elly recently learned that vowels (the letters &#8216;a&#8217;, &#8216;e&#8217;, &#8216;i&#8217;, &#8216;o&#8217;, &#8216;u&#8217; and &#8216;y&#8217;) are no longer cool on the internet. That&#8217;s why now she wants to remove some of the vowels in the nickname she uses. Elly wants her new nickname to contain no consecutive vowels, but she still wants to keep as many characters as possible.</p>
<p>You are given the current nickname Elly uses in the string <b>nickname</b>. Return its new length after it gets shortened.</p>
<p>Here <strong>my code</strong>:</p>
<pre>public class EllysNewNickname
    {
        public int getLength(string nickname)
        {
            string r = "";
            bool x = false;
            for (int i = 0; i &#60; nickname.Length; i++)
            {
                if (nickname[i] != 'a' &#38;&#38; nickname[i] != 'e' &#38;&#38; nickname[i] != 'i' &#38;&#38; nickname[i] != 'o' &#38;&#38; nickname[i] != 'u' &#38;&#38; nickname[i] != 'y')
                {
                    r += nickname[i].ToString();
                    x = false;
                }
                else
                {
                    if (x == false)
                    {
                        r += nickname[i].ToString();
                        x = true;
                    }
                }
            }
            return r.Length;
        }
    }</pre>
<p>If you have another approach, please share with me in a comment!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[New Business Imperative]]></title>
<link>http://tronsystems.com.au/2013/04/26/new-business-imperative/</link>
<pubDate>Fri, 26 Apr 2013 11:27:33 +0000</pubDate>
<dc:creator>bambiprice</dc:creator>
<guid>http://tronsystems.com.au/2013/04/26/new-business-imperative/</guid>
<description><![CDATA[Engaging with your customers is more challenging today and yet it is critical for business growth. O]]></description>
<content:encoded><![CDATA[<p>Engaging with your customers is more challenging today and yet it is critical for business growth.<br />
Online is the primary channel for conducting business and for managing our lives. Customers expect access and delivery across multiple channels. They also expect to provide feedback across multiple channels.<br />
The customer experience needs to be seamless and streamlined.<br />
We expect companies to be responding to our new expectations and listening to our feedback, the good and the not so good.<br />
Customers are not only posting when they are unhappy, they are also telling people and recommending products and services that have met their expectations. Surpass their expectations and they become quite zealous about promoting your product/service.<br />
Most customers are looking for consistency across channels, personalised interaction for returning customers. They want to feel that they are valued.<br />
<a href="http://bambiprice.files.wordpress.com/2013/04/customer-feedback.jpeg"><img class="alignnone size-medium wp-image-17" alt="customer feedback" src="http://bambiprice.files.wordpress.com/2013/04/customer-feedback.jpeg?w=300&#038;h=144" width="300" height="144" /></a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[10.000 views in 5 months! Thank you!]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/26/10-000-visits/</link>
<pubDate>Fri, 26 Apr 2013 08:09:30 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/26/10-000-visits/</guid>
<description><![CDATA[Hello! Today is a great day! The blog has reached 10.000 views! I would like to thank all of you.. E]]></description>
<content:encoded><![CDATA[<p>Hello! Today is a great day! The blog has reached 10.000 views!</p>
<p>I would like to thank all of you.. Everyone of you!</p>
<p>THANK YOU!</p>
<p>Now.. i wil continue working for all of you&#8230; I am really happy for this!</p>
<p><img class="size-full wp-image" id="i-2308" style="font-style:normal;line-height:23px;" alt="Image" src="http://topblogcoder.files.wordpress.com/2013/04/visits.jpg?w=199" /></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[vSphere 5.1 Update1 Available]]></title>
<link>http://aravindsivaraman.wordpress.com/2013/04/26/vsphere-5-1-update1-available/</link>
<pubDate>Fri, 26 Apr 2013 04:48:42 +0000</pubDate>
<dc:creator>Aravind</dc:creator>
<guid>http://aravindsivaraman.wordpress.com/2013/04/26/vsphere-5-1-update1-available/</guid>
<description><![CDATA[VMware has announced the availability of vSphere 5.1 Update 1 and this update includes for the follo]]></description>
<content:encoded><![CDATA[<p>VMware has announced the availability of vSphere 5.1 Update 1 and this update includes for the following products:</p>
<ul>
<li><a href="http://www.vmware.com/support/vsphere5/doc/vsphere-vcenter-server-51u1-release-notes.html" target="_blank">vCenter 5.1 Update1</a></li>
<li><a href="http://www.vmware.com/support/vsphere5/doc/vsphere-esxi-51u1-release-notes.html" target="_blank">ESXi 5.1 Update1</a></li>
<li><a href="http://www.vmware.com/support/srm/srm-releasenotes-5-1-1.html" target="_blank">SRM 5.1.1</a> and <a href="http://www.vmware.com/support/vsphere5/doc/vsphere-replication-511-release-notes.html" target="_blank">vSphere Replication 5.1.1</a></li>
<li><a href="http://www.vmware.com/support/vdr/doc/vdp_5110_releasenotes.html" target="_blank">vSphere Data Protection (VDP) Version 5.1.10</a></li>
<li><a href="http://www.vmware.com/support/vcd/doc/rel_notes_vcloud_director_512.html" target="_blank">vCloud Director 5.1.2</a></li>
</ul>
<p><strong>What&#8217;s New in vCenter 5.1 Update1?</strong></p>
<ul>
<li>vCenter can now be installed on Windows Server 2012</li>
<li>vSphere Essentials and Essentials Plus are no longer limited to 192Gb vRAM</li>
<li>Support of SQL Server 2012 and SQL Server 2008R2SP2 database for vCenter</li>
<li>Support for Gust Customization</li>
</ul>
<p><strong>What&#8217;s New in VDP 5.10?</strong></p>
<ul>
<li>Integration with vCenter alarms and alerts notification system</li>
<li>Ability to clone backup jobs</li>
<li>New filters for Restore tab</li>
<li>Added restore rehearsal</li>
<li><a href="http://blogs.vmware.com/vsphere/2013/04/vdp-5-1-10-ga.html" target="_blank">VDR to VDP Migration Utility</a> NOT available in VDP advanced</li>
</ul>
<p><strong>Whats&#8217;s New in vCloud Director 5.1.2?</strong></p>
<ul>
<li>Rights for creating, reverting, and removing snapshots</li>
<li>Allocation pool organization virtual datacenters can be elastic or non-elastic</li>
<li>Support for Microsoft SQL Server 2012</li>
<li>Support for Red Hat Enterprise Linux 6.3</li>
<li>Guest Customization support on Windows Server 2012</li>
</ul>
<p>Read this post to know about the feature and fixes included in <a href="http://blogs.vmware.com/vsphere/2013/04/srm-and-vr-5-1-1-released.html" target="_blank">SRM5.1.1 and vSphere Replication 5.1.1</a></p>
<p>Make sure to read all the release notes before upgrading to update1</p>
<p>Happy Upgrading <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[April Dirty Thirty Day 25 - Sixpoint Bengali Tiger]]></title>
<link>http://shortonbeer.wordpress.com/2013/04/25/april-dirty-thirty-day-25-sixpoint-bengali-tiger/</link>
<pubDate>Fri, 26 Apr 2013 02:56:53 +0000</pubDate>
<dc:creator>ShortOnBeer</dc:creator>
<guid>http://shortonbeer.wordpress.com/2013/04/25/april-dirty-thirty-day-25-sixpoint-bengali-tiger/</guid>
<description><![CDATA[Soooo I&#8217;ve been bad. I broke the post streak and I won&#8217;t lie to you, I missed a day of n]]></description>
<content:encoded><![CDATA[<p>Soooo I&#8217;ve been bad. I broke the post streak and I won&#8217;t lie to you, I missed a day of not trying a new beer. I could make excuses and I should (since I actually have an awesome excuse for once) but I won&#8217;t. I will just pick up where I left off.</p>
<p>Tonight&#8217;s April Dirty Thirty beer is&#8230;</p>
<p><div id="attachment_392" class="wp-caption aligncenter" style="width: 235px"><a href="http://shortonbeer.files.wordpress.com/2013/04/sixpoint.jpg"><img class="size-medium wp-image-392" alt="Sixpoint Bengali Tiger" src="http://shortonbeer.files.wordpress.com/2013/04/sixpoint.jpg?w=225&#038;h=300" width="225" height="300" /></a><p class="wp-caption-text">Sixpoint Bengali Tiger</p></div><br />
<h1><a title="Sixpoint Bengali Tiger" href="http://sixpoint.com/beers/core/bengalitiger" target="_blank">Sixpoint Bengali Tiger Ale</a></h1>
<h2>Critical Information:</h2>
<ul>
<li>6.4% ABV</li>
<li>62 IBUs</li>
<li>13 SRM</li>
</ul>
<h2>My Experience:</h2>
<h3>- POUR</h3>
<p>Poured from can into pint glass. It has an orange color and is mostly transparent. It has a large, puffy white head that clings to the glass.</p>
<h3>- SMELL</h3>
<p>It has an aroma of fresh hops and is citrus-y.</p>
<h3>- TASTE</h3>
<p>It&#8217;s bitter, then hoppy, then bitter again. It&#8217;s straw-like (is that something??) and has a hint of grapefruit.</p>
<h3>- FOOD PAIRING</h3>
<p>Gouda cheese or Peruvian chicken. Fried yuca anyone?</p>
<p><!--more--></p>
<h3>- OVERALL THOUGHTS</h3>
<p>Disappointed. I&#8217;ve been seeing the Beer Advocate guys and some bloggers running around touting Sixpoint. I still really want to try <a title="3Beans" href="http://beeradvocate.com/beer/profile/10607/88889/?ba=CB_Crowe" target="_blank">3Beans</a> but didn&#8217;t enjoy tonight&#8217;s Bengali Tiger that much.</p>
<p><strong>Score: 3/10</strong></p>
<p>Thank you for being a part of the April Dirty Thirty project. Keep the tweets and comments coming, you’re doing outstanding! Remember to use #AprilDirty30. I’d love to hear your thoughts on this beer, what you had tonight, what you&#8217;ve tried recently, anything.</p>
<p>One new beer a night for a month. Review it. Share it. Expand your beer knowledge.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[VMware Site Recovery Manager 5.1.1 and vSphere Replication 5.1.1 Release]]></title>
<link>http://thevirtualizationguy.wordpress.com/2013/04/25/vmware-site-recovery-manager-5-1-1-and-vsphere-replication-5-1-1-release/</link>
<pubDate>Thu, 25 Apr 2013 21:33:44 +0000</pubDate>
<dc:creator>gastonpantana</dc:creator>
<guid>http://thevirtualizationguy.wordpress.com/2013/04/25/vmware-site-recovery-manager-5-1-1-and-vsphere-replication-5-1-1-release/</guid>
<description><![CDATA[Both Site Recovery Manager and vSphere Replication have been updated and the 5.1.1 release is now av]]></description>
<content:encoded><![CDATA[<p>Both Site Recovery Manager and vSphere Replication have been updated and the 5.1.1 release is now available. This build it is almost completely filled with things that make SRM and VR work better.</p>
<p>Some of the fixed issues, for example, are things like:</p>
<ul>
<li>All sorts of timeout problems ranging from multiple operation timeouts to reprotect timeouts to HBA rescan timeouts</li>
<li>Custom vCenter https ports now work better with vSphere Replication</li>
<li>Pairing SRM servers using custom certificates and VCVA now works</li>
<li>Re-protect using vSphere Replication is more resilient</li>
</ul>
<p>&#160;</p>
<p>Get the release notes  for VMware vCenter Site Recovery Manager 5.1.1 from <a title="VMware vCenter Site Recovery Manager 5.1.1 Release Notes" href="https://www.vmware.com/support/srm/srm-releasenotes-5-1-1.html" target="_blank">here</a>.</p>
<p>Get the release notes  for VMware vSphere Replication 5.1.1 from <a title="VMware vSphere Replication 5.1.1 Release Notes" href="https://www.vmware.com/support/vsphere5/doc/vsphere-replication-511-release-notes.html" target="_blank">here</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Practice Room SRM 145 DIV 2, Problem 500 Rep]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/25/practice-room-srm-145-div-2-problem-500-rep/</link>
<pubDate>Thu, 25 Apr 2013 19:37:46 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/25/practice-room-srm-145-div-2-problem-500-rep/</guid>
<description><![CDATA[Here a new problem I´ve solved right now! Here i decided to convert the input to seconds, then with]]></description>
<content:encoded><![CDATA[<p>Here a new problem I´ve solved right now!</p>
<p>Here i decided to convert the input to seconds, then with a for loop, take each second beginning with i = 1, then do (i * 100) / totalSecs, and check if contains a &#8220;.&#8221;, (if is a double), if it is, then continue, else, add +1 to the final result. When the for loop ends, return the result as an int.</p>
<p>Here the <strong>problem statement</strong>:</p>
<p>You are writing firmware for an exercise machine. Each second, a routine in your firmware is called which decides whether it should display the percentage of the workout completed. The display does not have any ability to show decimal points, so the routine should only display a percentage if the second it is called results in a whole percentage of the total workout.</p>
<p>Given a string <b>time</b> representing how long the workout lasts, in the format &#8220;hours:minutes:seconds&#8221;, return the number of times a percentage will be displayed by the routine. The machine should never display 0% or 100%.</p>
<p>Here <strong>my code</strong>:</p>
<pre>public class ExerciseMachine
    {
        public int getPercentages(string time)
        {
            int res = 0;
            double temp = 0.0;
            string[] secs = time.Split(':');
            double sec = (double.Parse(secs[0]) * 3600.0) + (double.Parse(secs[1]) * 60.0) + double.Parse(secs[2]);
            for (int i = 1; i &#60; sec; i++)
            {
                temp = ((double)i * 100.0) / sec;
                if (!(temp.ToString().Contains(".")))
                    res++;
            }
            return res;
        }
    }</pre>
<p>If you have another approach, please share with me in a comment!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Coin exchange problem, by Karanpreet]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/25/coin-exchange-problem-by-karanpreet/</link>
<pubDate>Thu, 25 Apr 2013 09:37:37 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/25/coin-exchange-problem-by-karanpreet/</guid>
<description><![CDATA[Here a new useful explanation from our friend Karanpreet. The problem Given a value N, if we want to]]></description>
<content:encoded><![CDATA[<p>Here a new useful explanation from our friend Karanpreet.</p>
<p><strong>The problem</strong></p>
<p>Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1, S2, .. , Sm} valued coins, print all thw ays in which we can make the change.</p>
<p>For example, for N = 4 and S = {1,2,3}, there are four solutions: {1,1,1,1},{1,1,2},{2,2},{1,3}. For N = 10 and S = {2, 5, 3, 6}, there are five solutions: {2,2,2,2,2}, {2,2,3,3}, {2,2,6}, {2,3,5} and {5,5}.</p>
<p><strong>The code</strong></p>
<pre>#include&#60;iostream.h&#62;
#include&#60;conio.h&#62;
#include&#60;vector.h&#62;

void print_possibilities(int* coins,vector&#60;int&#62; &#38;str,int k,int sum,int step)
{
     if(sum==k)
     {
               for(int i=0;i&#60;str.size();i++)
               cout&#60;&#60;str[i]&#60;&#60;"+";
               cout&#60;&#60;"="&#60;&#60;k&#60;&#60;endl;          
     } 
     else
     {
         for(int i=step;i&#60;3;i++)
         {
                 if(sum+coins[i]&#60;=k)
                 {
                          str.push_back(coins[i]);
                          print_possibilities(coins,str,k,sum+coins[i],i);     
                          str.pop_back();                        
                 }        
                 else 
                 {
                      break;
                 }
         }    
     }   
}

main()
{
     vector&#60;int&#62; str;
     int coins[]={1,2,5};
     print_possibilities(coins,str,7,0,0);
     getch();      
}</pre>
<p>If you have some questions, let them in a comment and Karanpreet will answer asap.</p>
<p>Thank you</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[To print all subsets of an array, by Karanpreet]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/25/to-print-all-subsets-of-an-array-by-karanpreet/</link>
<pubDate>Thu, 25 Apr 2013 07:36:05 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/25/to-print-all-subsets-of-an-array-by-karanpreet/</guid>
<description><![CDATA[Here another useful explanation, by Karanpreet! The problem Here I have used vector.h header file to]]></description>
<content:encoded><![CDATA[<p>Here another useful explanation, by Karanpreet!</p>
<p><strong>The problem</strong></p>
<div>Here I have used vector.h header file to include the library functions for vector.</div>
<div>a is the array whose subsets are to be printed. I have used recursion, and n describes the recursion step.</div>
<div></div>
<div><strong>The code</strong></div>
<div></div>
<div>
<pre>#include&#60;iostream.h&#62;
#include&#60;conio.h&#62;
#include&#60;vector.h&#62;

void func(int n,int len,vector&#60;int&#62; &#38;str,int *a)
{
        if(n==len)
        {
                  int i=0;
                  for(int i=0;i&#60;str.size();i++){
                  cout&#60;&#60;str[i]&#60;&#60;" ";}
                  cout&#60;&#60;endl;          
        }  
        else
        {
            func(n+1,len,str,a);
            str.push_back(a[n]);
            func(n+1,len,str,a);
            str.pop_back();    
        }
}

main()
{
      vector&#60;int&#62; str;
      int a[]={1,2,3,4};
      func(0,4,str,a);
      getch();      
}</pre>
</div>
<div>If you have some questions, let them in a comment and Karanpreet will answer asap.</div>
<div></div>
<div>Thank you</div>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Practice Room SRM 351 DIV 2, Problem 250 Rep]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/25/practice-room-srm-351-div-2-problem-250-rep/</link>
<pubDate>Thu, 25 Apr 2013 05:21:19 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/25/practice-room-srm-351-div-2-problem-250-rep/</guid>
<description><![CDATA[Here a new problem I´ve solved right now! Here first i decide to store in a int[] array calles total]]></description>
<content:encoded><![CDATA[<p>Here a new problem I´ve solved right now!</p>
<p>Here first i decide to store in a int[] array calles total, the number os times each number repeat in the input. And put 6 and 9 together in the 6. Then, reduce the 6 doing, if total[6] % 2 == 0, then total[6] = total[6] / 2, else total[6] = (total[6] / 2) + 1.Then only get the higher num in the array and return it as an int.</p>
<p>Here the <strong>problem statement</strong>:</p>
<p>You are going to stick the number of your room on the door. The shop near your house suggests wonderful sets of plastic digits. Each set contains exactly ten digits &#8211; one of each digit between 0 and 9, inclusive. Return the number of sets required to write your room number. Note that 6 can be used as 9 and vice versa. </p>
<p>Here <strong>my code</strong>:</p>
<pre>public class RoomNumber
    {
        public int numberOfSets(int roomNumber)
        {
            int[] tot = new int[10];
            for (int i = 0; i &#60; roomNumber.ToString().Length; i++)
            {
                if (roomNumber.ToString()[i] == '9')
                    tot[6]++;
                else
                    tot[int.Parse(roomNumber.ToString()[i].ToString())]++;
            }
            if (tot[6] % 2 == 0)
                tot[6] = tot[6] / 2;
            else
                tot[6] = (tot[6] / 2) + 1;
            int res = -1;
            for (int i = 0; i &#60; tot.Length; i++)
            {
                if (tot[i] &#62; res)
                    res = tot[i];
            }
            return res;
        }
    }</pre>
<p>If you have another approach, please share with me in a comment!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Practice Room SRM 350 DIV 2, Problem 250 Rep]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/24/practice-room-srm-350-div-2-problem-250-rep/</link>
<pubDate>Wed, 24 Apr 2013 21:47:54 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/24/practice-room-srm-350-div-2-problem-250-rep/</guid>
<description><![CDATA[Here a new problem I´ve solved right now! Here i decided first convert the two strings toLower(). Th]]></description>
<content:encoded><![CDATA[<p>Here a new problem I´ve solved right now!</p>
<p>Here i decided first convert the two strings toLower(). Then with regular expressions, and with a foreach loop in the search string, go checking each letter, then count the number of occurrences in each word, and then do Math.Pow(n1 &#8211; n2, 2), and add to the result. Then return the result.</p>
<p>Here the <strong>problem statement</strong>:</p>
<p>The distance between two strings with respect to a letter is defined as <i>(n<sub>1</sub> &#8211; n<sub>2</sub>)<sup>2</sup></i>, where <i>n<sub>1</sub></i> and <i>n<sub>2</sub></i> are the number of occurrences (both lowercase and uppercase) of that letter in the first and second strings, respectively. The distance between two strings with respect to a third string is the sum of the distances between the two strings with respect to each letter in the third string.</p>
<p>You will be given three strings <b>a</b>, <b>b</b> and <b>letterSet</b>. All the letters in <b>letterSet</b> will be distinct. Return the distance between <b>a</b> and <b>b</b> with respect to <b>letterSet</b>. </p>
<p>Here <strong>my code</strong>:</p>
<pre>public class DistanceBetweenStrings
    {
        public int getDistance(string a, string b, string letterSet)
        {
            int res = 0;
            a = a.ToLower();
            b = b.ToLower();
            foreach (char c in letterSet)
            {
                Regex r = new Regex(c.ToString());
                res += int.Parse(Math.Pow((double)r.Matches(a).Count - (double)r.Matches(b).Count, 2).ToString());
            }
            return res;
        }
    }</pre>
<p>If you have another approach, please share with me in a comment!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Practice Room SRM 349 DIV 2, PRoblem 250 Rep]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/24/practice-room-srm-349-div-2-problem-250-rep/</link>
<pubDate>Wed, 24 Apr 2013 21:36:21 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/24/practice-room-srm-349-div-2-problem-250-rep/</guid>
<description><![CDATA[Here a new problem I´ve solved right now! Here i decided to use regular expression to get all the in]]></description>
<content:encoded><![CDATA[<p>Here a new problem I´ve solved right now!</p>
<p>Here i decided to use regular expression to get all the index where the searched word appear&#8230; then beginning with i = 1, check if i &#62;= i &#8211; 1, if it is, then add +1 to the result. We need to take care if there are 0 coincidences, or only 1, in these cases only return 0 or 1 in each case.</p>
<p>Here the <strong>problem statement</strong>:</p>
<p>You have been tasked with writing a function that will scan through a given document, and determine how many times a given word or phrase appears in that document. However, it is important that your function does not count overlapping occurrences. For instance, if the document were &#8220;abababa&#8221;, and the search keyword was &#8220;ababa&#8221;, you could find the keyword starting at index 0, or at index 2, but not both, since they would overlap.</p>
<p>You must concatenate the elements of the given string[] <b>doc</b> into a single string. Then, return the maximum number of non-overlapping occurrences of the string <b>search</b>.</p>
<p>To find a maximal set of non-overlapping occurrences, perform the following procedure. Starting from the left, find the first occurrence of the search string. Then, continuing with the character immediately following the search string, continue looking for the next occurrence. Repeat until no new occurrences can be found. By continuing immediately following each found occurrence, we guarantee that we will not count overlaps. </p>
<p>Here <strong>the code</strong>:</p>
<pre>public class DocumentSearch
    {
        public int nonIntersecting(string[] doc, string search)
        {
            int res = 0;
            Regex r = new Regex(search);
            string total = "";
            for (int i = 0; i &#60; doc.Length; i++)
                total += doc[i];
            List&#60;int&#62; list = new List&#60;int&#62;();
            foreach (Match m in r.Matches(total))
                list.Add(m.Index);
            if (list.Count == 0)
                return 0;
            if (list.Count == 1)
                res++;
            else
            {
                res++;
                for (int a = 1; a &#60; list.Count; a++)
                {
                    if (list[a] &#62;= list[a - 1] + search.Length)
                        res++;
                }
            }
            return res;
        }
    }</pre>
<p>If you have another approach, please share with me in a comment!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Printing all valid combinations of parenthesis, by Karanpreet]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/24/printing-all-valid-combinations-of-parenthesis-by-karanpreet/</link>
<pubDate>Wed, 24 Apr 2013 21:17:48 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/24/printing-all-valid-combinations-of-parenthesis-by-karanpreet/</guid>
<description><![CDATA[Here a nother useful explanation,by Karanpreet! The code #include&lt;iostream.h&gt; #include&lt;coni]]></description>
<content:encoded><![CDATA[<p>Here a nother useful explanation,by Karanpreet!</p>
<p><strong>The code</strong></p>
<pre>#include&#60;iostream.h&#62;
#include&#60;conio.h&#62;
#include&#60;vector.h&#62;

void func(int left,int right,vector&#60;char&#62; str)
{
     //if right becomes zero you have to just print the string bcos this is the last step of recursion, kind of base case
     if(right==0)
     {
                 for(int i=0;i&#60;str.size();i++)
                 {
                         cout&#60;&#60;str[i];        
                 }            
                 cout&#60;&#60;endl;
                 return;
     }
     //if there are still left parenthesis which can be used , use them!
     if(left&#62;0)
     {
               str.push_back('(');
               func(left-1,right,str);
               str.pop_back();
     }
     //this means more of left has been used and right can be used now
     if(left&#60;right)
     {
                   str.push_back(')');
                   func(left,right-1,str);    
                   str.pop_back();          
     }
}

main()
{
      vector&#60;char&#62; str;
     // we are generating all the valis combinatiuons of 3 pairs of parenthesis, so 3 is passed as left        and right to the function
      func(3,3,str);
      getch();      
}</pre>
<p>If you have some questions, let them in a comment and Karanpreet will answer asap.</p>
<p>Thank you</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[To get the minimum element from stack, by Karanpreet]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/24/to-get-the-minimum-element-from-stack-by-karanpreet/</link>
<pubDate>Wed, 24 Apr 2013 19:54:25 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/24/to-get-the-minimum-element-from-stack-by-karanpreet/</guid>
<description><![CDATA[Hi, another useful explanation of our friend Karanpreet! The problem This question implements the li]]></description>
<content:encoded><![CDATA[<p>Hi, another useful explanation of our friend Karanpreet!</p>
<p><strong>The problem</strong></p>
<div>This question implements the linked list as a stack and uses recursion to find out the minimum element from the stack.</div>
<div>node is the element of the stack which is implemented by a linked list</div>
<div>insert is a function analogous to push in the stack</div>
<div>get_min is the function we called to get the minimum from the stack, which calls itself recursively.</div>
<div></div>
<div><strong>The code</strong></div>
<div></div>
<div>
<pre>#include&#60;iostream.h&#62;
#include&#60;conio.h&#62;

int ctr=0;
struct node
{
       int n;
       node* next;      
};

node* head=NULL;

void insert(int data)
{
     ctr++;
     node* p=(node*)malloc(sizeof(node));
     p-&#62;n=data;
     if(head==NULL)
     {
                   head=p;
                   head-&#62;next=NULL;
                   }    
     else
     {
          node* temp=head;
          head=p;
          head-&#62;next=temp;
     }
}

int get_min(node* elem)
{
    if(elem==NULL)
    return 32767;
    int min_from_rec=get_min(elem-&#62;next);
    if(min_from_rec&#62;elem-&#62;n)
    return elem-&#62;n;
    else
    return min_from_rec;
}

main()
{
      insert(2);
      insert(4);
      insert(-1);
      insert(3);
      insert(5);
      insert(-8);
      insert(6);
      cout&#60;&#60;get_min(head)&#60;&#60;endl&#60;&#60;ctr;
      getch();      
}</pre>
</div>
<div>If you have some questions, let them in a comment, and Karanpreet will answer them asap.</div>
<div></div>
<div>Thank you</div>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Maximum continuous subset sum in an array in O(N) time, by Karanpreet]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/24/maximum-continuous-subset-sum-in-an-array-in-on-time-by-karanpreet/</link>
<pubDate>Wed, 24 Apr 2013 19:49:21 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/24/maximum-continuous-subset-sum-in-an-array-in-on-time-by-karanpreet/</guid>
<description><![CDATA[Hi, here Karanpreet bring another useful explanation! The problem Keep a var tempsum which keeps tra]]></description>
<content:encoded><![CDATA[<p>Hi, here Karanpreet bring another useful explanation!</p>
<p><strong>The problem</strong></p>
<div>Keep a var tempsum which keeps track of the sum of the processed elements so far. Whenever tempsum becomes lesser than zero,reset its value to zero again, this step is actually saying that the earlier processed elements cannot be a part of the maxsum. If the tempsum now is greater than the maxsum update the maxsum to the value of tempsum.</div>
<div>There are two additional variables start and end which tell the indexes where to start and where to end to get the maximum sum for the continous subset array.</div>
<div></div>
<div><strong>The code</strong></div>
<div></div>
<div>
<pre>#include&#60;iostream.h&#62;
#include&#60;conio.h&#62;

int func(int* a,int len,int &#38;start,int &#38;end)
{
    int tempsum=0,maxsum=0;
    for(int i=0;i&#60;len;i++)
    {
             tempsum=tempsum+a[i];
             if(tempsum&#62;0)
             {
                          if(tempsum&#62;maxsum)
                          {
                              maxsum=tempsum;   
                              end=i; 
                              }         
             }       
             else
             {
                 tempsum=0;  
                 start=i+1;  
             }
    }    
    return maxsum;
}

main()
{
      int a[]={-2,3,6,-8,7,6,3,-8};
      int start, end;
      cout&#60;&#60;"The maximum sum is "&#60;&#60;func(a,8,start,end);
      cout&#60;&#60;" starting at "&#60;&#60;start&#60;&#60;" ending at "&#60;&#60;end;
      getch();      
}</pre>
</div>
<div>If you have some questions, please let them in a comment and Karanpreet will answer asap.</div>
<div></div>
<div>Thank you</div>
<div></div>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Social Relationship]]></title>
<link>http://tronsystems.com.au/2013/04/24/social-relationship/</link>
<pubDate>Wed, 24 Apr 2013 05:34:01 +0000</pubDate>
<dc:creator>bambiprice</dc:creator>
<guid>http://tronsystems.com.au/2013/04/24/social-relationship/</guid>
<description><![CDATA[Most organisations are only just starting to consider SRM and yet the stock trading software is ahea]]></description>
<content:encoded><![CDATA[<p>Most organisations are only just starting to consider SRM and yet the stock trading software is ahead of most companies. Unfortunately this resulted in it reacting immediately to a fake tweet. I am sure this will be assessed and tweeked to minimise the chances of it happening again.<br />
Even so, it is fairly easy to see how SRM can keep you abreast of what customers are saying about your company and/or products. The good and not so good.<br />
Only a small percentage of Board Members have a social media account and are therefore struggling to see the importance of using SRM.<br />
Integrate this with your CRM for a complete coverage of touch points with your customers and you will see immediate generation of data for your Boards to consider.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Practice Room SRm 348 DIV 2, Problem 250 Rep]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/23/practice-room-srm-348-div-2-problem-250-rep/</link>
<pubDate>Tue, 23 Apr 2013 21:28:48 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/23/practice-room-srm-348-div-2-problem-250-rep/</guid>
<description><![CDATA[Here a new problem I´ve solved right now! Here i decided to check each letter, f is &#8216;N&#8217;,]]></description>
<content:encoded><![CDATA[<p>Here a new problem I´ve solved right now!</p>
<p>Here i decided to check each letter, f is &#8216;N&#8217;, then if contain &#8216;S&#8217;, remove the &#8216;S&#8217; and the &#8216;N&#8217;, and do this with all the letters, then when the for loop ends, convert to array, sort, and convert back to a string to return.</p>
<p>Here the <strong>problem statement</strong>:</p>
<p>Billy is going to his grandmother&#8217;s house. To help him do that, his mother has written down a detailed list of instructions for him to follow. Each instruction is a character &#8216;N&#8217;, &#8216;S&#8217;, &#8216;W&#8217; or &#8216;E&#8217;, telling him to go exactly 1 block to the north, south, west or east, respectively. Billy&#8217;s city consists of an infinitely large grid of streets, where each street extends infinitely to both sides, and the space between 2 adjacent streets going in the same direction is always 1 block. Billy&#8217;s house and his grandmother&#8217;s house are both located at street corners in this city.</p>
<p>Billy knows that his mother does not always choose the shortest path. Therefore, he wants to make a new list of instructions that will also lead him to his grandmother&#8217;s house, but uses the minimum possible number of instructions.</p>
<p>You will be given <b>inst</b>, a string with the original list made by Billy&#8217;s mom. Return the new list Billy wants. If there are several solutions, return the one that comes first alphabetically. </p>
<p>Here <strong>my code</strong>:</p>
<pre>public class OptimalList
    {
        public string optimize(string inst)
        {
            for (int i = 0; i &#60; inst.Length; i++)
            {
                if (inst[i] == 'N')
                {
                    if (inst.Contains("S"))
                    {
                        inst = inst.Remove(i, 1);
                        inst = inst.Remove(inst.IndexOf("S"), 1);
                        i = -1;
                    }
                }
                else if (inst[i] == 'S')
                {
                    if (inst.Contains("N"))
                    {
                        inst = inst.Remove(i, 1);
                        inst = inst.Remove(inst.IndexOf("N"), 1);
                        i = -1;
                    }
                }
                else if (inst[i] == 'E')
                {
                    if (inst.Contains("W"))
                    {
                        inst = inst.Remove(i, 1);
                        inst = inst.Remove(inst.IndexOf("W"), 1);
                        i = -1;
                    }
                }
                else if (inst[i] == 'W')
                {
                    if (inst.Contains("E"))
                    {
                        inst = inst.Remove(i, 1);
                        inst = inst.Remove(inst.IndexOf("E"), 1);
                        i = -1;
                    }
                }
            }
            string[] temp = new string[inst.Length];
            for (int i = 0; i &#60; inst.Length; i++)
                temp[i] = inst[i].ToString();
            Array.Sort(temp);
            string res = "";
            for (int i = 0; i &#60; temp.Length; i++)
                res += temp[i];
            return res;
        }
    }</pre>
<p>If you have another approach, please share with me in a comment!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Practice Room SRM 347 DIV 2, Problem 250 Rep]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/23/practice-room-srm-347-div-2-problem-250-rep/</link>
<pubDate>Tue, 23 Apr 2013 21:08:26 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/23/practice-room-srm-347-div-2-problem-250-rep/</guid>
<description><![CDATA[Here a new problem I´ve solved right now! Here only follow the steps in the problem statement. You h]]></description>
<content:encoded><![CDATA[<p>Here a new problem I´ve solved right now!</p>
<p>Here only follow the steps in the problem statement. You have all the clues there.</p>
<p>Here the <strong>problem statement</strong>:</p>
<p>You wish to buy a new car and would like to get the cheapest option available. However, you recognize that the initial purchase cost is only a part of what you will need to spend on the car and you want to factor tax and fuel costs into your decision. You will be given a string[] <b>cars</b> giving the specifications of various models of car and an int <b>annualDistance</b> containing the distance that you will drive each year. For the car that you choose, the purchase cost only has to be paid once, the tax cost specific to the model has to be paid once per year and the fuel cost should be calculated as FUEL PRICE * DISTANCE DRIVEN / FUEL EFFICIENCY, where the fuel efficiency is specific to the car. You should calculate which car model in <b>cars</b> has the lowest cost on aggregate after <b>years</b> amount of time and return a double containing this cost.</p>
<p> Each element of <b>cars</b> will be formatted &#8220;<i>&#60;PURCHASE COST&#62; &#60;TAX&#62; &#60;FUEL EFFICIENCY&#62;</i>&#8221; (quotes for clarity). </p>
<p>Here <strong>my code</strong>:</p>
<pre>public class CarBuyer
    {
        public double lowestCost(string[] cars, int fuelPrice, int annualDistance, int years)
        {
            double result = 10000000000.0;
            for (int i = 0; i &#60; cars.Length; i++)
            {
                double res = 0.0;
                string[] temp = cars[i].Split(' ');
                res += double.Parse(temp[0]);
                res += double.Parse(temp[1]) * (double)years;
                res += ((double)fuelPrice * ((double)annualDistance * (double)years)) / double.Parse(temp[2]);
                if (res &#60; result)
                    result = res;
            }
            return result;
        }
    }</pre>
<p>If you have another approach, please share with me in a comment!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Practice Room SRM 346 DIV 2, Problem 250 Rep]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/23/practice-room-srm-346-div-2-problem-250-rep/</link>
<pubDate>Tue, 23 Apr 2013 18:01:50 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/23/practice-room-srm-346-div-2-problem-250-rep/</guid>
<description><![CDATA[Here a new problem I´ve solved right now! Here i decided to use a for loop, fron 0, to n.Length]]></description>
<content:encoded><![CDATA[<p>Here a new problem I´ve solved right now!</p>
<p>Here i decided to use a for loop, fron 0, to n.Length &#8211; 1, then check if mine[i] == &#8216;&#60;&#8217; &#38;&#38; mine[i + 1] == &#8216;&#62;&#8217; then remove the diamond from the mine, add +1 to the final result, and put 1 to -1 to begin the loop again. When the for loop ends, return the result as an int.</p>
<p>Here the <strong>problem statement</strong>:</p>
<p>You are a diamond hunter looking for diamonds in a peculiar <b>mine</b>. This <b>mine</b> is a string of &#8216;&#60;&#8217; and &#8216;&#62;&#8217; characters, and each diamond is a substring of the form &#8220;&#60;&#62;&#8221;. Each time you find a diamond, you remove it and the residual mine is updated by removing the 2 characters from the string.</p>
<p>For example, if you have a mine like &#8220;&#62;&#60;&#60;&#62;&#60;&#62;&#62;&#62;&#60;&#8221;, you can start by removing the first appearance of &#8220;&#60;&#62;&#8221; to get &#8220;&#62;&#60;&#60;&#62;&#62;&#62;&#60;&#8221;, then remove the only remaining diamond to get &#8220;&#62;&#60;&#62;&#62;&#60;&#8221;. Note that this produces a new diamond which you can remove to get &#8220;&#62;&#62;&#60;&#8221;. Since there are no diamonds left, your expedition is done.</p>
<p>Given a string <b>mine</b>, return the number of diamonds that can be found. Note that the order in which you remove simultaneous appearances of diamonds is irrelevant; any order will lead to the same result. </p>
<p>Here <strong>my code</strong>:</p>
<pre>public class DiamondHunt
    {
        public int countDiamonds(string mine)
        {
            int res = 0;
            if(mine.Length == 1)
                return 0;
            for (int i = 0; i &#60; mine.Length - 1; i++)
            {
                if (mine[i] == '&#60;' &#38;&#38; mine[i + 1] == '&#62;')
                {
                    mine = mine.Remove(i, 2);
                    res++;
                    i = -1;
                }
            }
            return res;
        }
    }</pre>
<p>If you have another approach, please share with me in a comment!</p>
<p>Thank you very much</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Lexicographic rank of a String without actually generating all the permutations, by Karanpreet]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/23/lexicographic-rank-of-a-string-without-actually-generating-all-the-permutations-by-karanpreet/</link>
<pubDate>Tue, 23 Apr 2013 14:30:10 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/23/lexicographic-rank-of-a-string-without-actually-generating-all-the-permutations-by-karanpreet/</guid>
<description><![CDATA[Hi, here another useful explanation from Karanpreet! The problem Given a string, find its rank among]]></description>
<content:encoded><![CDATA[<p>Hi, here another useful explanation from Karanpreet!</p>
<p><strong>The problem</strong></p>
<p>Given a string, find its rank among all its permutations sorted lexicographically. For example, rank of “abc” is 1, rank of “acb” is 2, and rank of “cba” is 6.</p>
<div>The logic is that the offset generated by a character is equal to the difference between the values of the present character and the character which has the lowest ascii value from among the remaining characters.</div>
<div>the concept of remaining characters is implemented using a linked list.</div>
<div>At each step we encounter a character and see the number of steps that it takes to go from beginning of the list to that character in the linked list. This is the step. Now this step is multiplied by the number of permutations of the remaining characters and this gives the offset generated by this character.</div>
<div>For example if the first character we encounter is &#8216;c&#8217; the step will be 2 and 3! will be the number of permutations generated by the remaining characters. You may be wondering why that works, for 4 character string we have 3! permutations of first char as &#8216;a&#8217; and 3! permutations with first character as &#8216;b&#8217;. Thats the logic. We calculate the offset for every character of the string and add it up.</div>
<div></div>
<div><strong>The code</strong></div>
<pre>#include&#60;iostream.h&#62;
#include&#60;conio.h&#62;

struct node
{
       char data;
       node* next;       
};

node* head=NULL;
node* tail=NULL;

void insert(char a)
{
     node* p=new node;
     p-&#62;data=a; p-&#62;next=NULL;
     if(head==NULL)
     {head=p;tail=p;}
     else
     {
         tail-&#62;next=p;
         tail=tail-&#62;next;    
     }     
}

void remove(char c)
{
     node* p=head,*q=head;
     while(p!=NULL)
     {
                   if(p-&#62;data==c)
                   break;
                   q=p;
                   p=p-&#62;next;              
     }
     if(p==head)
     {head=head-&#62;next;}
     else
     q-&#62;next=p-&#62;next;
}

void iterate()
{
   cout&#60;&#60;endl;
     node* p=head;
     while(p!=NULL)
     {
                   cout&#60;&#60;p-&#62;data;
                   p=p-&#62;next;              
     }          
}

void initialize()
{
     insert('a');     
     insert('b');     
     insert('c');     
     insert('d');     
}

int distance(char a)
{
    node* p=head; int j=0;
    while(p!=NULL &#38;&#38; p-&#62;data!=a)
    {j++;p=p-&#62;next;}   
    remove(a); 
    return j;
}

int fact(int n)
{
    if(n==1 &#124;&#124; n==0)
    return 1;
    else
    return n*fact(n-1);    
}

int rank(char *a,int len)
{
        int i=0,res=0,step;
        while(i&#60;4)
        {
                 step=distance(a[i]);
                 res=res+step*fact(len-i);
                 i++;                 
        }
        return res+1;
}

main()
{
      char *a="dbca";
      initialize();
      cout&#60;&#60;"The lexicographic rank is "&#60;&#60;rank(a,3);
      getch();    
}</pre>
<p>If you have some questions, please let them in a comment, and Karan will answer asap.</p>
<p>Thank you</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[All permutations of a string using recursion, by Karanpreet]]></title>
<link>http://topblogcoder.wordpress.com/2013/04/23/all-permutations-of-a-string-using-recursion-by-karanpreet/</link>
<pubDate>Tue, 23 Apr 2013 08:10:27 +0000</pubDate>
<dc:creator>Alethor</dc:creator>
<guid>http://topblogcoder.wordpress.com/2013/04/23/all-permutations-of-a-string-using-recursion-by-karanpreet/</guid>
<description><![CDATA[Hi, here a new useful explanation from our friend Karanpreet. #include&lt;iostream.h&gt; #include]]></description>
<content:encoded><![CDATA[<p>Hi, here a new useful explanation from our friend Karanpreet.</p>
<pre>#include&#60;iostream.h&#62;
#include&#60;conio.h&#62;

void swap(char *a,char *b)
{
     char temp;
     temp=*a;
     *a=*b;
     *b=temp;     
}

void perm(char* a,int i,int n)
{
          if(i==n-1)
          {
                  cout&#60;&#60;a&#60;&#60;endl;
                  return;
          }
          for(int j=i;j&#60;n;j++)
          {
                  swap(&#38;a[j],&#38;a[i]);
                  perm(a,i+1,n);
                  swap(&#38;a[j],&#38;a[i]);
                  }
}

main()
{
      //if we have the character array already sorted then the permutations are automatically in lexicographic order
      char a[]="abc";
      perm(a,0,3);
      getch();      
}</pre>
<p>If you have some questions, leave them in a comment and Karanpreet will answer asap!</p>
<p>Thank you</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Mobile Path - Cloud Mobile Development ]]></title>
<link>http://tronsystems.com.au/2013/04/23/mobile-path-cloud-mobile-development/</link>
<pubDate>Tue, 23 Apr 2013 05:51:40 +0000</pubDate>
<dc:creator>bambiprice</dc:creator>
<guid>http://tronsystems.com.au/2013/04/23/mobile-path-cloud-mobile-development/</guid>
<description><![CDATA[As with any emerging areas considering the holistic view is essential and yet sometimes naivety of t]]></description>
<content:encoded><![CDATA[<p>As with any emerging areas considering the holistic view is essential and yet sometimes naivety of the industry means this is difficult. Mobile and Cloud uptake has not only been accepted but is expected by consumers more quickly than was anticipated by most organisations. For some companies this will mean stepping into areas not previously considered.<br />
According to Forrester, most mobile app developers are skilled at client-side front-end development. This explains why we have started seeing an increase in BaaS, Back-End-As-A-Service offerings.<br />
Recently I was talking to a technologist from Jordan. He commented that most people only have smartphones and tablets and are finding it difficult if companies do not have apps available.<br />
<span style="font-style:inherit;line-height:1.625;">This will only increase exponentially and companies need to start addressing these consumer requirements immediately and incorporate them as part of their overall business strategy.<br />
</span>This is where CRM and SRM becomes even more relevant. To accurately track your customer requirements and to converse with these customers you need to have appropriate systems in place.</p>
<p><a href="http://bambiprice.files.wordpress.com/2013/04/download.jpeg"><img class="alignnone size-full wp-image-11" alt="download" src="http://bambiprice.files.wordpress.com/2013/04/download.jpeg?w=299&#038;h=168" width="299" height="168" /></a></p>
<p>&#160;</p>
]]></content:encoded>
</item>

</channel>
</rss>
