Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #110191

Re: Recursive To non-Recursive Procedure

From Bruno Campanini <brunocam@libero.it>
Newsgroups microsoft.public.excel.programming
Subject Re: Recursive To non-Recursive Procedure
Date 2017-08-15 18:19 +0200
Organization Aioe.org NNTP Server
Message-ID <omv6uj$lhd$1@gioia.aioe.org> (permalink)
References (13 earlier) <ompuc7$s3q$1@dont-email.me> <omspt5$17ja$1@gioia.aioe.org> <omu7vv$sgt$1@dont-email.me> <omue7k$1gqq$1@gioia.aioe.org> <omuomv$c91$1@dont-email.me>

Show all headers | View raw


Peter T has brought this to us :
> "Bruno Campanini" <brunocam@libero.it> wrote in message
>> Peter T explained :
>>
>>>> Are you prepared to pay the same if you fail?
>>>
>>> You have the advantage because somehow you seem to know I can't, whereas 
>>> I've never claimed I know I can. But as I think it's more than 50% 
>>> probable I can do what I said I "might" be able to do - yes.
>>
>> Fantastic!
>> I'm prepared to pay if you success but you are not prepared to pay
>> the same if you fail, because you only stated "I could", "I might".
>>
>> Ok, why then did you ask me if I was prepared to pay
>> when you were not prepared to do the same?
>
> Read again, I said yes to your question.
>
> Need to agree the amount, enough to make it worthwhile but can comfortably 
> afford to loose. Also agree in advance something like the following
>
> 1. Improve recursive speed of the function as posted for use in Excel
>
> I stand by "perhaps" 100x but rusults would vary significantly depending on 
> variables such as: the length of input string, system specs, Excel version, 
> and other factors such how the function is called, if screenupdating is 
> disabled and no doubt others. Short strings wouldn't be significantly 
> different if even measurable.
>
> In an older system with 2007 or earlier, with an input string of say 8+ 
> letters returning a large number of permutations to the sheet I'd expect at 
> least 50x if not 100x faster or more. 64-bit Excel is much better with things 
> like this, I'd still expect a significant improvment but much less, still a 
> mutlitple order of improvement though.
>
> The function would need to be adapted, obviously, possibly with new 
> arguments.
>
> Run Test1 below to call your function, give your results with an idea of your 
> system specs particualrly Excel version and if Office-64. I'll then say 
> roughly what I'd expect to improve results by.
>
> 2. non-recursive alternative.
> This is straightforward, one (or more ?) routine(s) that do not call self and 
> return an accurate list of all permuations of the input string.
>
> 3. As there are in effect two challenges, if I succeed in one but fail in the 
> other, no payment on either way.
>
> 4. Amount - suggest something
>
> 5. Time limit, suggest something reasonable to complete.
>
> 6 Other?
>
>
>> I understand, some times in a discussion our passion takes
>> our hand and makes us say more then we reasonably would.
>
> No passions raised on my part. I tried to help, you threw it back in my face. 
> Even despite all that I remained polite towards you. I know nothing about you 
> so your arrogance and insults were of no consequence to me.
>
>
> Sub Test1()
> Dim s As String
> Dim i As Long, t As Single
>     s = "ABCDE"
>     For i = 70 To 73
>         s = s & Chr$(i)
>         Range("A:A").ClearContents
>         DoEvents
>         t = Timer
>         Call Permutation(s)
>         t = Timer - t
>         Debug.Print s; " Len=" & Len(s); "  Sec: " & t
>     Next
> End Sub
>
> Sub Permutation(Str1 As String, _
>     Optional Str2 As String = vbNullString, _
>     Optional ByRef Xrow As Long = 1)
> Dim i As Integer, xLen As Integer, a As String, b As String
>
> xLen = Len(Str1)
> If xLen < 2 Then
>     Range("A" & Xrow) = Str2 & Str1
>     Xrow = Xrow + 1
> Else
>     For i = 1 To xLen
>         a = Left(Str1, i - 1) & Right(Str1, xLen - i)
>         b = Str2 & Mid(Str1, i, 1)
>         Call Permutation(a, b, Xrow)
>     Next
> End If
>
> End Sub
>
> Peter T

Too many words... keep calm.

All the best Peter.
Bruno

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-07-13 15:14 +0200
  Re: Recursive To non-Recursive Procedure "Auric__" <not.my.real@email.address> - 2017-07-13 19:52 +0000
    Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-07-14 00:32 +0200
      Re: Recursive To non-Recursive Procedure "Auric__" <not.my.real@email.address> - 2017-07-14 19:33 +0000
        Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-07-14 22:36 +0200
          Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-07-16 17:58 +0100
            Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-07-16 19:51 +0200
              Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-07-16 19:46 +0100
                Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-07-17 10:52 +0200
                Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-07-17 12:45 +0100
                Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-07-17 20:17 +0200
                Re: Recursive To non-Recursive Procedure Living the Dream <noodnutt@gmail.com> - 2017-08-08 05:23 -0700
                Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-08-11 17:43 +0100
                Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-08-13 02:19 +0200
                Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-08-13 17:26 +0100
                Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-08-14 20:24 +0200
                Re: Recursive To non-Recursive Procedure GS <gs@v.invalid> - 2017-08-14 23:14 -0400
                Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-08-15 08:19 +0100
                Re: Recursive To non-Recursive Procedure GS <gs@v.invalid> - 2017-08-15 03:28 -0400
                Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-08-15 08:39 +0100
                Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-08-15 12:49 +0200
                Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-08-15 08:35 +0100
                Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-08-15 11:17 +0200
                Re: Recursive To non-Recursive Procedure "Peter T" <askformy@gmail.com> - 2017-08-15 13:21 +0100
                Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-08-15 18:19 +0200
                Re: Recursive To non-Recursive Procedure Bruno Campanini <brunocam@libero.it> - 2017-08-13 03:16 +0200
                Re: Recursive To non-Recursive Procedure Living the Dream <noodnutt@gmail.com> - 2017-08-29 06:08 -0700

csiph-web