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


Groups > microsoft.public.excel.programming > #110111 > unrolled thread

Recursive To non-Recursive Procedure

Started byBruno Campanini <brunocam@libero.it>
First post2017-07-13 15:14 +0200
Last post2017-08-29 06:08 -0700
Articles 7 on this page of 27 — 5 participants

Back to article view | Back to microsoft.public.excel.programming


Contents

  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

Page 2 of 2 — ← Prev page 1 [2]


#110187

FromBruno Campanini <brunocam@libero.it>
Date2017-08-15 12:49 +0200
Message-ID<omujjv$1nrc$1@gioia.aioe.org>
In reply to#110179
GS wrote:
>> Are you prepared to pay the same if you fail?
>>
>> Bruno
>
> Since I already know Peter can do this, I propose prepayment by you for the 
> solution. Don't worry about validation because many of the regulars here will 
> handle that for you because clearly your attitude has earned a great deal of 
> mistrust here!

Why don't you switch your brain on before talking|writing?

Bruno

[toc] | [prev] | [next] | [standalone]


#110182

From"Peter T" <askformy@gmail.com>
Date2017-08-15 08:35 +0100
Message-ID<omu7vv$sgt$1@dont-email.me>
In reply to#110178
"Bruno Campanini" <brunocam@libero.it> wrote in message
> Peter T explained on 13-08-17 :
>> "Bruno Campanini" <brunocam@libero.it> wrote in message
>>>> LOL!
>>>>
>>>> Silly thing is I might have given him an example of what I think he was 
>>>> looking for, and suggested how he could speed up his original function 
>>>> (for use in Excel) perhaps by 100x
>>>
>>> I challenge you to do that!
>>> Don't let me think you are a liar.
>>
>> That's two challenges, significantly speed up your recursive routine as 
>> posted and come up with a non-recursive alternative.
>>
>> I could probably do both or I wouldn't have said so. But if you think I'm 
>> going to spend time working on examples for someone with such an awful 
>> attitude towards people you don't know who tried to help you think again. 
>> It is of no concern to me if you want to think I am a liar.
>>
>> You made the challenges so propose what you will pay if I can demonstrate 
>> what I suggested. If it's meaningful I'll have a go. Your call.
>
> 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.

Peter T 

[toc] | [prev] | [next] | [standalone]


#110186

FromBruno Campanini <brunocam@libero.it>
Date2017-08-15 11:17 +0200
Message-ID<omue7k$1gqq$1@gioia.aioe.org>
In reply to#110182
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?
I understand, some times in a discussion our passion takes
our hand and makes us say more then we reasonably would.

Well, that said and forgotten... are you prepared to restart
discussion from the beginning?

Bruno

[toc] | [prev] | [next] | [standalone]


#110189

From"Peter T" <askformy@gmail.com>
Date2017-08-15 13:21 +0100
Message-ID<omuomv$c91$1@dont-email.me>
In reply to#110186
"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 

[toc] | [prev] | [next] | [standalone]


#110191

FromBruno Campanini <brunocam@libero.it>
Date2017-08-15 18:19 +0200
Message-ID<omv6uj$lhd$1@gioia.aioe.org>
In reply to#110189
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

[toc] | [prev] | [next] | [standalone]


#110168

FromBruno Campanini <brunocam@libero.it>
Date2017-08-13 03:16 +0200
Message-ID<omo98g$k33$1@gioia.aioe.org>
In reply to#110148
Living the Dream pretended :
> FWIW I reckon all you good folk who give of not only your knowledge, but also 
> your time are awesome.
>
> You have helped and got me on the right track on many occasions and am 
> extremely grateful & thankful.
Love is a many splendored thing...
>
> Maybe poor Bruno needs a Group Hug to help him feel better.. :)
Maybe not...

> I always taught my children & grandchildren the philosophy that you will 
> always attract more ants with honey than with vinegar.
If you are a philosopher then Plato was a plumber!

What a disaster has been Internet, all people allowed to write.
Using icons like stupid children!

Bruno

[toc] | [prev] | [next] | [standalone]


#110234

FromLiving the Dream <noodnutt@gmail.com>
Date2017-08-29 06:08 -0700
Message-ID<c279ad55-4c61-49e8-943a-cacdefa9f60d@googlegroups.com>
In reply to#110168
A..HaHaHa...

Oh my, your parents must be bursting with pride at the kind, polite son they have raised.

Meh, as for your comments, whatever sunshine! needless to say, and i'm fairly certain I echo many here by now, I'm thinking you will find it somewhat challenging to garner any responses to future posting within this group.

Adieu my poor ignorant friend.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | microsoft.public.excel.programming


csiph-web