<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>Algorithms Forum RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest threads from the 'Algorithms' forum at Programmer's Heaven, excluding replies.</description>
    <language>en</language>
    <copyright>Copyright 2010 Programmers Heaven</copyright>
    <pubDate>Mon, 15 Mar 2010 20:37:40 -0700</pubDate>
    <lastBuildDate>Mon, 15 Mar 2010 20:37:40 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>algorithm problem in sofware project</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/414438/414438/algorithm-problem-in-sofware-project/</link>
      <description>hey dudes&lt;br /&gt;
we're in a middle of a software project, and we got stuck somewhere. in this part we should do something like this:&lt;br /&gt;
1. get a rule that looks like !0-4?2-4@@   that defines a password structure, and a dictionary filename&lt;br /&gt;
2. break the rule into parts, !0-4  ?2-4 @ @&lt;br /&gt;
   each part represents an other rule- let's say !0-4 means the first part of the password should contain between 0 and 4 english chars, ?2-4 means that the second part should contain between 2 and 4 general chars (including %,^ etc), and @ means that we receive a word from a dictionary, so let's say the dictionary has the words "abc" and "asd", a good password (that fits in the rule) is alpha%&amp;amp;abcasd, because we can divide it into alph a%&amp;amp; abc asd and it fits the rule.&lt;br /&gt;
3. we get an int n (and here's the hard part), we want to generate the n'th password, so that for different n's we'll get different results. in other words, there is a 1 to 1 correspondence between the n's and the passwords generated by the rule.&lt;br /&gt;
the problem is that we can get rules like !0-2!0-2, and then the password aa can be generated in 3 different ways- (aa)(), ()(aa), (a)(a). this ofc gets even more complex for longer and more complex rules.&lt;br /&gt;
&lt;br /&gt;
i'd be glad if someone could help us out here...we're really stuck :\&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/414438/414438/algorithm-problem-in-sofware-project/</guid>
      <pubDate>Thu, 11 Mar 2010 09:13:10 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Problems with a time algorithm.</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/413474/413474/problems-with-a-time-algorithm/</link>
      <description>Hey there. I have a little problem that is probably not hard to figure out, but I have been programming for a week straight and my brain is a little cheezed out:P&lt;br /&gt;
&lt;br /&gt;
I have number of datapoints that each need a timestamp. The time between each datapoint is 0.25 seconds, and I need an algorithm to convert the index of the datapoint to a timestamp. If I only needed to know each second the problem would have been nonexistant, by just using Seconds = Datapoints Mod 60 and so forth, but now I need to put in hundreds of a second too.&lt;br /&gt;
&lt;br /&gt;
So, the datapoints is added 4 per second, so the timeformat should be something like HH:MM:SS:%%.&lt;br /&gt;
&lt;br /&gt;
i would really appreciate any help given.&lt;br /&gt;
&lt;br /&gt;
Cheers&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/413474/413474/problems-with-a-time-algorithm/</guid>
      <pubDate>Mon, 15 Feb 2010 06:27:15 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>need help with an algorithm</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/413099/413099/need-help-with-an-algorithm/</link>
      <description>Hello everyone&lt;br /&gt;
Am searching for a simple example algorithm that is suitable to be amended according to the constant execution time paradigm.&lt;br /&gt;
&lt;br /&gt;
and also a proposal to rewrite the algorithm so that the variation in execution time will be reduced.&lt;br /&gt;
&lt;br /&gt;
Is it possible?&lt;br /&gt;
Thanks to you&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/413099/413099/need-help-with-an-algorithm/</guid>
      <pubDate>Fri, 05 Feb 2010 05:51:04 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Expression equivalence checking</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/412745/412745/expression-equivalence-checking/</link>
      <description>Hi All.&lt;br /&gt;
&lt;br /&gt;
I'm trying to solve following problem:&lt;br /&gt;
&lt;br /&gt;
Given two ariphmetic expressions, operations are +, -, *, /, () and operands are just identifiers.&lt;br /&gt;
Operations are not associative, but + and * are commutative.&lt;br /&gt;
The question is: whether it is possible to rename identifiers and to rearrange operands at commutative operations (+, *) so that to reduce one expression to another.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
1.&lt;br /&gt;
Input:&lt;br /&gt;
 A+B&lt;br /&gt;
 C+B&lt;br /&gt;
Output:&lt;br /&gt;
 Yes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.&lt;br /&gt;
Input:&lt;br /&gt;
 (A+A)+B&lt;br /&gt;
 C+(D+D)&lt;br /&gt;
Выход:&lt;br /&gt;
 Yes&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
3.&lt;br /&gt;
Input:&lt;br /&gt;
 (A+A)+B&lt;br /&gt;
 (A+B)+A&lt;br /&gt;
Output:&lt;br /&gt;
 No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. &lt;br /&gt;
Input:&lt;br /&gt;
 A+A+B&lt;br /&gt;
 A+B+A&lt;br /&gt;
Output:&lt;br /&gt;
 NO&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
5.&lt;br /&gt;
Input:&lt;br /&gt;
 A+B*C&lt;br /&gt;
 A1+A2*A2&lt;br /&gt;
Output:&lt;br /&gt;
 No&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
6.&lt;br /&gt;
Input:&lt;br /&gt;
 (A+B-C)*(C+C)&lt;br /&gt;
 (D+D)*(B+A-D)&lt;br /&gt;
Output:&lt;br /&gt;
 Yes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I created following algorithm:&lt;br /&gt;
&lt;br /&gt;
1. Build expressions' trees. (They are binaries trees).&lt;br /&gt;
2. Check for trees ismorphism with fixed roots.&lt;br /&gt;
3. Check identifiers sets.&lt;br /&gt;
&lt;br /&gt;
But is this algorithm correct?&lt;br /&gt;
And how to do stage 3 except full recursive?&lt;br /&gt;
&lt;br /&gt;
Thanks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/412745/412745/expression-equivalence-checking/</guid>
      <pubDate>Mon, 01 Feb 2010 11:40:23 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Read From File And Return the max sum</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/412618/412618/read-from-file-and-return-the-max-sum/</link>
      <description>Hey everybody,So I've given a triangular pyramid of numbers with N (1&amp;lt;Ν≤1000) levels. I need to write a program that finds the highest sum of numbers starting from the top level and ending at the bottom level of the pyramid. At each step I can go diagonally down to the left or diagonally down to the right as indicated by the lines joining the numbers in the diagrams below.&lt;br /&gt;
The first line of the input file INPUT.TXT contains N. The following N lines contain the integers for each level, separated by a single space. These integers are positive and have a maximum value of 100.&lt;br /&gt;
The output file OUTPUT.TXT should contain a single number, which is the maximum sum that the program has found.&lt;br /&gt;
&lt;br /&gt;
Input.Txt&lt;br /&gt;
3&lt;br /&gt;
8&lt;br /&gt;
12 1&lt;br /&gt;
2 7 8&lt;br /&gt;
&lt;br /&gt;
OUTPUT.TXT&lt;br /&gt;
27&lt;br /&gt;
&lt;br /&gt;
Please help :P&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/412618/412618/read-from-file-and-return-the-max-sum/</guid>
      <pubDate>Sat, 30 Jan 2010 09:02:30 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Read From File And Return the max sum</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/412617/412617/read-from-file-and-return-the-max-sum/</link>
      <description>Hey everybody,So I've given a triangular pyramid of numbers with N (1&amp;lt;Ν≤1000) levels. I need to write a program that finds the highest sum of numbers starting from the top level and ending at the bottom level of the pyramid. At each step I can go diagonally down to the left or diagonally down to the right as indicated by the lines joining the numbers in the diagrams below.&lt;br /&gt;
The first line of the input file INPUT.TXT contains N. The following N lines contain the integers for each level, separated by a single space. These integers are positive and have a maximum value of 100.&lt;br /&gt;
The output file OUTPUT.TXT should contain a single number, which is the maximum sum that the program has found.&lt;br /&gt;
&lt;br /&gt;
Input.Txt&lt;br /&gt;
3&lt;br /&gt;
8&lt;br /&gt;
12 1&lt;br /&gt;
2 7 8&lt;br /&gt;
&lt;br /&gt;
OUTPUT.TXT&lt;br /&gt;
27&lt;br /&gt;
&lt;br /&gt;
Please help :P&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/412617/412617/read-from-file-and-return-the-max-sum/</guid>
      <pubDate>Sat, 30 Jan 2010 09:00:11 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>methods of visiting all the elements on a given level of a binary tree</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/412214/412214/methods-of-visiting-all-the-elements-on-a-given-level-of-a-binary-tree/</link>
      <description>Hello&lt;br /&gt;
I know of only one method of visiting the elements on one level of a tree. This method is not very efficient. This is the way I do it(PHP implementation):&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
private function NextNode(&amp;amp;$node,$curlevel,$desiredlevel,&amp;amp;$nodesnr=
null)
        {
            if($node == null)
                return;
            $curlevel++;

            if($curlevel == $desiredlevel)
            {
                $this-&amp;gt;Visit($node);
                if($nodesnr!==null)
                    $nodesnr++;
            }

            $this-&amp;gt;NextNode($node-&amp;gt;left,$curlevel,$desiredlevel,$nodesnr);
            $this-&amp;gt;NextNode($node-&amp;gt;right,$curlevel,$desiredlevel,$nodesnr);
        }
&lt;/pre&gt;&lt;br /&gt;
I travese all the nodes of the tree in depth(inorder) and I check if teh level is equal to my desired level and if so I visit that node. I also keep track on the number of nodes but that is not relevant to the question.&lt;br /&gt;
This is inefficient because it goes throgh the entire tree.&lt;br /&gt;
&lt;br /&gt;
Does anyone know of a better(more efficient) sollution?&lt;br /&gt;
Thank you in advance</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/412214/412214/methods-of-visiting-all-the-elements-on-a-given-level-of-a-binary-tree/</guid>
      <pubDate>Sat, 23 Jan 2010 10:38:17 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>methods of all the elements on a given level of a binary tree</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/412213/412213/methods-of-all-the-elements-on-a-given-level-of-a-binary-tree/</link>
      <description>Hello&lt;br /&gt;
I know of only one method of visiting the elements on one level of a tree. This method is not very efficient. This is the way I do it(PHP implementation):&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
private function NextNode(&amp;amp;$node,$curlevel,$desiredlevel,&amp;amp;$nodesnr=
null)
        {
            if($node == null)
                return;
            $curlevel++;

            if($curlevel == $desiredlevel)
            {
                $this-&amp;gt;Visit($node);
                if($nodesnr!==null)
                    $nodesnr++;
            }

            $this-&amp;gt;NextNode($node-&amp;gt;left,$curlevel,$desiredlevel,$nodesnr);
            $this-&amp;gt;NextNode($node-&amp;gt;right,$curlevel,$desiredlevel,$nodesnr);
        }
&lt;/pre&gt;&lt;br /&gt;
I travese all the nodes of the tree in depth(inorder) and I check if teh level is equal to my desired level and if so I visit that node. I also keep track on the number of nodes but that is not relevant to the question.&lt;br /&gt;
This is inefficient because it goes throgh the entire tree.&lt;br /&gt;
&lt;br /&gt;
Does anyone know of a better(more efficient) sollution?&lt;br /&gt;
Thank you in advance&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/412213/412213/methods-of-all-the-elements-on-a-given-level-of-a-binary-tree/</guid>
      <pubDate>Sat, 23 Jan 2010 10:34:36 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Neural Network general question</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/411916/411916/neural-network-general-question/</link>
      <description>Hello,&lt;br /&gt;
&lt;br /&gt;
I'm experimenting with backprop NN's and have a couple questions regarding implementation / training:&lt;br /&gt;
&lt;br /&gt;
1. Since the usual method of training a BPNN means normalizing inputs to accommodate the sigmoidal function limitations, how does one accurately model a continuous function with solutions that fall outside these ranges?  I've got a few answers in my mind, but it's not really clear to me just yet.  That is, suppose I want to model the relationship between, say, product demand and price.  Do I have to normalize the NN input / target values for training and then "scale" the outputs after I run the NN so the outputs are meaningful in their original context (i.e., they look like real prices, not normalized values)?&lt;br /&gt;
&lt;br /&gt;
2. Is it legitimate to mix real and discrete inputs?  Citing the product demand example, suppose the price of a product in a particular area is dependent upon two things: the month of the year and the local demand in terms of quantity. It would seem most sensible to normalize the quantities as a series of real (continuous) values, and the months as discrete integers (vectors in a binary or one-of-N format).  Thus, the inputs would consist of a real-value input for demand, and a series of inputs for a vector of 1's and 0's to represent the month.&lt;br /&gt;
&lt;br /&gt;
Any comments / links would be appreciated.&lt;br /&gt;
&lt;br /&gt;
Thanks.  &lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/411916/411916/neural-network-general-question/</guid>
      <pubDate>Thu, 14 Jan 2010 06:40:11 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Outlook VBA Network file access problem</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/411597/411597/outlook-vba-network-file-access-problem/</link>
      <description>Hi Guys,&lt;br /&gt;
&lt;br /&gt;
I have a problem running the following code when the file path is pointed at a mapped network drive location. It runs perfectly when pointed at my core drive but I have to run it over a network!! The code runs to this line and then exits without error!&lt;br /&gt;
&lt;br /&gt;
oWB.Worksheets(strSheetName).Cells(theRow + 1, 2).Value = Mid(Item.Body, lLen + lRmsNo, 5)&lt;br /&gt;
&lt;br /&gt;
I am using XP SP3 Outlook 2003 VBA 6.5 (nope, can't change this selection!)&lt;br /&gt;
&lt;br /&gt;
Any ideas would be appreciated:&lt;br /&gt;
&lt;br /&gt;
Sub SetRAMS(ByVal Item As Object)&lt;br /&gt;
&lt;br /&gt;
    Dim strPath As String&lt;br /&gt;
    Dim strSheetName As String&lt;br /&gt;
    Dim aRng As Range&lt;br /&gt;
    Dim oExcel As Excel.Application&lt;br /&gt;
    Dim oWB As Workbook&lt;br /&gt;
    Dim xlSht As Excel.Worksheet&lt;br /&gt;
    Dim myOlMItem As Outlook.MailItem&lt;br /&gt;
    Dim strName As String&lt;br /&gt;
    Dim lLen As Long&lt;br /&gt;
    Dim lLenNxt As Long&lt;br /&gt;
    Dim strRmNo As String&lt;br /&gt;
    Dim strRmLoc As String&lt;br /&gt;
    Dim strRmDet As String&lt;br /&gt;
    Dim strTemp As String&lt;br /&gt;
    Dim rngCell As Range&lt;br /&gt;
    Dim rngTmp As Range&lt;br /&gt;
        &lt;br /&gt;
    Dim lRmsNo As Long 'RAMS no offset&lt;br /&gt;
    Dim lRmDes As Long 'RAMS description offset&lt;br /&gt;
    Dim lRmLoc As Long 'RAMS physical location offset&lt;br /&gt;
    Dim lLenTot As Long 'Body string total length&lt;br /&gt;
    &lt;br /&gt;
    Dim theRow As Variant&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    lRmsNo = Len("New RAMS Request: R0")&lt;br /&gt;
    lRmDes = Len("Details: ")&lt;br /&gt;
    lRmLoc = Len("In Relation to: ")&lt;br /&gt;
    &lt;br /&gt;
    strRmNo = "New RAMS Request: R0"&lt;br /&gt;
    strRmDet = "Details: "&lt;br /&gt;
    strRmLoc = "In Relation to: "&lt;br /&gt;
    &lt;br /&gt;
    lLenTot = Len(Item.Body)&lt;br /&gt;
    &lt;br /&gt;
    strSheetName = "Sheet1"&lt;br /&gt;
    &lt;br /&gt;
strPath = "G:\Works\RAMS TEMP.xls"&lt;br /&gt;
&lt;br /&gt;
    Set oExcel = New Excel.Application&lt;br /&gt;
    &lt;br /&gt;
                   ' On Error GoTo error_now:&lt;br /&gt;
&lt;br /&gt;
                     Set oWB = oExcel.Workbooks.Open(strPath, 2, False)&lt;br /&gt;
                            &lt;br /&gt;
                            &lt;br /&gt;
                            oWB.Worksheets(strSheetName).Activate&lt;br /&gt;
                            &lt;br /&gt;
                                           &lt;br /&gt;
       theRow = oWB.Worksheets(strSheetName).Cells(1, 2).End(xlDown).Row&lt;br /&gt;
                            &lt;br /&gt;
                                &lt;br /&gt;
                  lLen = InStr(1, Item.Body, strRmNo, vbTextCompare)&lt;br /&gt;
                                                        &lt;br /&gt;
 oWB.Worksheets(strSheetName).Cells(theRow + 1, 2).Value = Mid(Item.Body, lLen + lRmsNo, 5)&lt;br /&gt;
                                                                      &lt;br /&gt;
                    lLen = InStr(1, Item.Body, strRmDet, vbTextCompare)&lt;br /&gt;
lLenNxt = (lLen - InStr(1, Item.Body, strRmLoc, vbTextCompare)) - lRmLoc&lt;br /&gt;
                     lLen = InStr(1, Item.Body, strRmLoc, vbTextCompare)&lt;br /&gt;
                  &lt;br /&gt;
 oWB.Worksheets(strSheetName).Cells(theRow + 1, 4).Value = Mid(Item.Body, lLen + lRmLoc, lLenNxt)&lt;br /&gt;
                    &lt;br /&gt;
              lLen = InStr(1, Item.Body, strRmDet, vbTextCompare)&lt;br /&gt;
                            &lt;br /&gt;
oWB.Worksheets(strSheetName).Cells(theRow + 1, 3).Value = Mid(Item.Body, lLen + lRmDes, lLenTot - lLen)&lt;br /&gt;
oWB.Worksheets(strSheetName).Cells(theRow + 1, 1).RowHeight = 12&lt;br /&gt;
                            &lt;br /&gt;
                            oWB.Save&lt;br /&gt;
                            oWB.Close&lt;br /&gt;
                                                            &lt;br /&gt;
                Set oExcel = Nothing&lt;br /&gt;
                Set oWB = Nothing&lt;br /&gt;
                &lt;br /&gt;
            Exit Sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks in advance&lt;br /&gt;
Aidan&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/411597/411597/outlook-vba-network-file-access-problem/</guid>
      <pubDate>Wed, 06 Jan 2010 15:36:58 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Find if a sum of any two elements is set S is equal to given x in nlgn</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/411596/411596/find-if-a-sum-of-any-two-elements-is-set-s-is-equal-to-given-x-in-nlgn/</link>
      <description>Hi!&lt;br /&gt;
I got a little problem with this excercise from Introduction to Algorithms (Cormen et al.).&lt;br /&gt;
&lt;br /&gt;
Given a set S of n integers, and an integer x, describe an algorithm of time complexity n*lg(n) which finds if sum of any two elements from S are equal to x.&lt;br /&gt;
&lt;br /&gt;
Examining every pair gives n*n algorithm, which is not what I want.&lt;br /&gt;
I think a merge-sort like algorithm could be used, but have no idea how to check if there are two such elements in two subsets (the merge step) in linear time. But maybe the whole idea is wrong. If someone can give any hints on this, I'd appreciate it =)&lt;br /&gt;
&lt;br /&gt;
Oh. My second idea is a 2*n*lg(n) algorithm given below.&lt;br /&gt;
&lt;br /&gt;
merge-sort(S) // takes n*lg(n)&lt;br /&gt;
for each y in S: // n times&lt;br /&gt;
    r = x - y&lt;br /&gt;
    binary-search(S, r) // takes at most lg(n)&lt;br /&gt;
    if found then return&lt;br /&gt;
&lt;br /&gt;
If anyone knows a better (faster) solution please let me know.&lt;br /&gt;
&lt;br /&gt;
regards&lt;br /&gt;
LaChupacabra&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/411596/411596/find-if-a-sum-of-any-two-elements-is-set-s-is-equal-to-given-x-in-nlgn/</guid>
      <pubDate>Wed, 06 Jan 2010 15:17:42 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Find specific row in N * N matrix</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/411516/411516/find-specific-row-in-n--n-matrix/</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
I need an algorithm to tell me what rows (row number) in N * N matrix are all 0.&lt;br /&gt;
&lt;br /&gt;
for example:&lt;br /&gt;
&lt;br /&gt;
0 1 0 1 0 ... 1&lt;br /&gt;
0 0 0 0 1 ... 0&lt;br /&gt;
0 0 0 0 0 ... 0  &lt;br /&gt;
. . . . . . . .  &lt;br /&gt;
. . . . . . . . &lt;br /&gt;
. . . . . . . .   &lt;br /&gt;
1 1 1 1 1 ... 1&lt;br /&gt;
0 1 1 0 0 ... 0&lt;br /&gt;
0 0 0 0 0 ... 0&lt;br /&gt;
&lt;br /&gt;
above n * n matrix has 2 rows that all entries are 0.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/411516/411516/find-specific-row-in-n--n-matrix/</guid>
      <pubDate>Tue, 05 Jan 2010 06:12:26 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Reqd algo for getting different results based on 'n' conditions</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/410992/410992/reqd-algo-for-getting-different-results-based-on-n-conditions/</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
Which algorithm should be used to solve problems like these:&lt;br /&gt;
&lt;br /&gt;
condition1	condition2	condition3	result&lt;br /&gt;
a1		b1		c1 		res1&lt;br /&gt;
a2		b2		c2		res2&lt;br /&gt;
a3		b3		c3 		res3&lt;br /&gt;
a2		b4		c2		res4&lt;br /&gt;
a4	 	b2 		c2		res4&lt;br /&gt;
a4	 	b4		c2		res4&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/410992/410992/reqd-algo-for-getting-different-results-based-on-n-conditions/</guid>
      <pubDate>Sun, 20 Dec 2009 03:11:33 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Automated design of a wireless network</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/409978/409978/automated-design-of-a-wireless-network/</link>
      <description>Hello!&lt;br /&gt;
Help me please with the following problem:&lt;br /&gt;
There is a set A of censors in 2-dim. space with known coordinates (x,y). Also there is the set B of points of potential location of wireless routers (WiFi/ZigBee/etc). Each censor must be connected with a wire with length not more than L to the closest router. The max. radius of the wireless connection (i.e. max distance between 2 neighbouring routers) = R. Surely, R is much larger than L. Also there is the limit of number of censors connected to one router. Each router must be able to communicate with at least one another router, so that all of them create a connected graph without isolated 'islands'. I need to find the subset of B where to place the routers so that the total number of routers is minimal.&lt;br /&gt;
&lt;br /&gt;
After search in Google I realized that this problem is called "facility location problem", but it has no restrictions about distance between facilities. It deals only with distances between a facility and clients. I think that at first I'll solve the facility location and then check the constraint about "connected graph" and if it's not satisfied, add more routers as graph bridges etc - is that right?&lt;br /&gt;
The actual questions are:&lt;br /&gt;
1. Have you ever met software for automated design of networks, that computes the optimal locations for communication nodes on the same principles as I've described?&lt;br /&gt;
2. What literature, websites and keywords could you suggest?&lt;br /&gt;
3. In whole, what ideas arise, what algoritms and methods can help in such task?&lt;br /&gt;
Thanks in advance.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/409978/409978/automated-design-of-a-wireless-network/</guid>
      <pubDate>Sat, 28 Nov 2009 08:37:37 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>8 queens problem</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/409419/409419/8-queens-problem/</link>
      <description>hello,&lt;br /&gt;
&lt;br /&gt;
can someone help me wiht writing the algorithm for the 8 queens problem.&lt;br /&gt;
&lt;br /&gt;
Thanx,&lt;br /&gt;
akshay&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/409419/409419/8-queens-problem/</guid>
      <pubDate>Tue, 17 Nov 2009 01:01:45 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Unique Number Generation</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/409069/409069/unique-number-generation/</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
Suppose I have a list of numbers, say (a,b....n) i want to generate a unique number say u so that no other list, say (a1,b1... n1) will not give a number u1 and u!=u1 if (a,b...n)!=(a1,b1...n1)&lt;br /&gt;
&lt;br /&gt;
More over (a,b,...n) is same list as (b,a...n), so they should both generate u, ie order does not matter.&lt;br /&gt;
&lt;br /&gt;
Any one has any idea?&lt;br /&gt;
&lt;br /&gt;
What i came up with is (a+b+...n)+(a*b*...*n), can this fail in any time?&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Jishnu&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/409069/409069/unique-number-generation/</guid>
      <pubDate>Tue, 10 Nov 2009 23:35:44 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Find ANY ONE of the k smallest elements</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/408279/408279/find-any-one-of-the-k-smallest-elements/</link>
      <description>Hey guys, I was hoping someone could help me out with this problem, I might be over thinking it too much and the answer might be very simple but its not getting to me.&lt;br /&gt;
&lt;br /&gt;
The problem has to deal with the k-smallest element problem, you are given n elements and an integer k such that 1 &amp;lt; k &amp;lt; n. The problem is to find ANY ONE of the k smallest elements.&lt;br /&gt;
&lt;br /&gt;
So for example, if k = 4, the output may be either the first, second, third, or fourth-smallest element.&lt;br /&gt;
&lt;br /&gt;
I am looking for a FAST algorithm to solve this problem and to figure out how many comparisons it performs. I also need to give a lower bound as a function of n and k on the number of comparisons needed to solve this problem.&lt;br /&gt;
&lt;br /&gt;
Any help is appreciated, thanks!&lt;br /&gt;
&lt;br /&gt;
Joey&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/408279/408279/find-any-one-of-the-k-smallest-elements/</guid>
      <pubDate>Sun, 25 Oct 2009 03:22:40 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>a tiny problem</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/403367/403367/a-tiny-problem/</link>
      <description>As the following picture:&lt;br /&gt;
It's a circle that is consist of the numbers,how can i simply calculate the distance between some tow numbers,for example,5 and 8 is 3;22 and 2 is 4 ???????????&lt;br /&gt;
                     0  1  2  3  4  5&lt;br /&gt;
                   23                6&lt;br /&gt;
                   22                7&lt;br /&gt;
                   21                8&lt;br /&gt;
                   20                9&lt;br /&gt;
                   19                10&lt;br /&gt;
                   18                11&lt;br /&gt;
                     17 16 15 14 13 12 &lt;br /&gt;
                  &lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/403367/403367/a-tiny-problem/</guid>
      <pubDate>Fri, 09 Oct 2009 01:22:49 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Algorithm for finding out the cheapst combination</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/403318/403318/algorithm-for-finding-out-the-cheapst-combination/</link>
      <description>Hello, I have a few sets which are like&lt;br /&gt;
&lt;br /&gt;
SET A(1,2,3,11,10)  - $30&lt;br /&gt;
SET B(2,5,8)        - $20&lt;br /&gt;
SET C(6)             -$25&lt;br /&gt;
SET D(6,8)           -$30&lt;br /&gt;
SET E(7,5)           -$20&lt;br /&gt;
SET F(5,6,7,8,9,10)  -$60&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
and so on... All are random, Now consider sets D,E and F I want to buy the cheapest combination for a set, SET Q(7,8,6,5) the answer should be SET D + SET E, not the SET F&lt;br /&gt;
&lt;br /&gt;
Please link... thanks&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/403318/403318/algorithm-for-finding-out-the-cheapst-combination/</guid>
      <pubDate>Fri, 09 Oct 2009 00:36:44 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Optimization problem with sets.</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/401954/401954/optimization-problem-with-sets/</link>
      <description>Hello!&lt;br /&gt;
&lt;br /&gt;
I have a set that contains maximum 10^6 items. All item are 4^n number, where 0 &amp;lt;= n &amp;lt;= 11, all items have a price that can be 1 &amp;lt;= price &amp;lt;= 10^8. And I also have another number k, where k is 4^n number and 0 &amp;lt;= n &amp;lt;= 11.  The items are ordered monotonically first according to size of numbers, then to prices. &lt;br /&gt;
I want to take the sum of the items that equal to number k, and the price is minimal.&lt;br /&gt;
&lt;br /&gt;
The example:&lt;br /&gt;
A := {16(1),16(2),16(3),16(4),64(11)}and k=64. (format: Number (price) -&amp;gt; 16(1))&lt;br /&gt;
So, the solution is 16(1),16(2),16(3),16(4), because 1+2+3+4=10 smaller then 11.&lt;br /&gt;
&lt;br /&gt;
Any idea?&lt;br /&gt;
Thanks!&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/401954/401954/optimization-problem-with-sets/</guid>
      <pubDate>Sun, 04 Oct 2009 07:17:00 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>About random question</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/400809/400809/about-random-question/</link>
      <description>Hi, guys!&lt;br /&gt;
    I have read a lot algorithms about random-generation,most of them use the system time as the seed,and then calculate it with &lt;br /&gt;
formula Rand_Number = (Rand_Seed * X + Y) mod Z, why use the system time as the seed,is it random enough? then if the seed is random,why calculate it again through this formula?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/400809/400809/about-random-question/</guid>
      <pubDate>Sun, 27 Sep 2009 22:01:07 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Software Development training</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/396637/396637/software-development-training/</link>
      <description>Hi Guys&lt;br /&gt;
&lt;br /&gt;
I would like to develop web based database/applications.&lt;br /&gt;
&lt;br /&gt;
I would like to develop websites, web based database type applications and web based forum applications&lt;br /&gt;
&lt;br /&gt;
I am a total beginner into this field and would like some help with training.&lt;br /&gt;
&lt;br /&gt;
There are several things out there like PHP,.net,mysql,SERVOY...........&lt;br /&gt;
&lt;br /&gt;
Can somebody suggest the best platform/language for this type of job?&lt;br /&gt;
&lt;br /&gt;
I am planning to take some training and then hopefully get started.&lt;br /&gt;
&lt;br /&gt;
John&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/396637/396637/software-development-training/</guid>
      <pubDate>Sun, 06 Sep 2009 08:00:06 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Genetic algorithm</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/396124/396124/genetic-algorithm/</link>
      <description>Hello, i am a new user of Matlab &lt;br /&gt;
and i want to create a genetic algorithm optimizing the wights of a fuzzy map. my problem is that i am not familiar with the genetic algorithm functions of matlab and, thus, i cant insert propely my objective function. any tips ?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/396124/396124/genetic-algorithm/</guid>
      <pubDate>Sun, 30 Aug 2009 06:04:47 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Levenshtein algorithm</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/395548/395548/levenshtein-algorithm/</link>
      <description>hi,i just came across the  string distance algorithm.&lt;br /&gt;
I took a paper and a pen to work out the exact algorithm.The answer seems to be correct.&lt;br /&gt;
But i could not understand why it is like that.&lt;br /&gt;
to fill d[i][j] &lt;br /&gt;
we look left,top,left diagonal.&lt;br /&gt;
(i guess this is where we check whether to insert,replace or delete)&lt;br /&gt;
But i am not sure how it is and why it is.&lt;br /&gt;
Can someone explain me why d's are checked for all three conditions .&lt;br /&gt;
I went throught this algo in wiki andhttp://www.merriampark.com/ld.htm&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/395548/395548/levenshtein-algorithm/</guid>
      <pubDate>Sat, 22 Aug 2009 06:33:16 -0700</pubDate>
      <category>Algorithms</category>
    </item>
    <item>
      <title>Optimization</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/394515/394515/optimization/</link>
      <description>Hello! I am a beginner programmer. I have a problem with the runtime of one of my applications. &lt;br /&gt;
&lt;br /&gt;
I have a website application that tries to compute for recommended objects to users. The recommended results is based on the user as well as the currently viewed object.&lt;br /&gt;
&lt;br /&gt;
My problem is, I have 500 artworks and almost 30 users. What I do is, for each user, I compute the value for recommendation for EACH artwork. So that means, for 1 object, I compare ALL of the other objects to it. Then after the computation, I store it in the Database. So for each user, I have around 250000 records inside the Database.&lt;br /&gt;
&lt;br /&gt;
Can I have any tips regarding on how to optimize it? Either some changes to the Database model or some changes to the code. I have 3 FOR loops (1 for user, 1 for viewed object, 1 for target objects). I have already tried using UNION ALL, but the INSERT statements doesn't seem to be the case.&lt;br /&gt;
&lt;br /&gt;
Help please!&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/394515/394515/optimization/</guid>
      <pubDate>Sat, 01 Aug 2009 18:32:21 -0700</pubDate>
      <category>Algorithms</category>
    </item>
  </channel>
</rss>