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


Groups > comp.lang.c++ > #12289

Re: Converting recursive algorithm to an iterative version

From 88888 Dihedral <dihedral88888@googlemail.com>
Newsgroups comp.lang.c++
Subject Re: Converting recursive algorithm to an iterative version
Date 2011-12-10 02:14 -0800
Organization http://groups.google.com
Message-ID <17620010.1187.1323512084027.JavaMail.geo-discussion-forums@prie17> (permalink)
References <618ba19e-c74f-4fcd-a16a-a6542270c73d@j10g2000vbe.googlegroups.com> <4ee1ad88$0$2805$7b1e8fa0@news.nbl.fi> <10678810.1375.1323463864546.JavaMail.geo-discussion-forums@pret21> <4ee32c58$0$2787$7b1e8fa0@news.nbl.fi>

Show all headers | View raw


On Saturday, December 10, 2011 5:54:32 PM UTC+8, Juha Nieminen wrote:
> 88888 Dihedral <dihedr...@googlemail.com> wrote:
> > If you are writing programs to be run infrequently for trivial jobs, 
> > I have to say that in this kind of trivial cases there is no need for any optimization or improvement for this kind of programming. 
> 
>   And my point is that *regardless* of where the code might be used,
> converting a naturally recursive algorithm into an iterative form that
> avoids the recursive function call is usually premature optimization of
> the bad kind (makes the code significantly more complicated for little
> to no benefit).

There are very limited cases for recursive functions to be used in C. 
The quick sort in the c lib  is notorious to be choked quite often. 
Tree  visiting of 30K nodes or less  in C is too simple to be modified for speeds.     
 

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Converting recursive algorithm to an iterative version Ania <anka.stepien@gmail.com> - 2011-12-07 15:48 -0800
  Re: Converting recursive algorithm to an iterative version Victor Bazarov <v.bazarov@comcast.invalid> - 2011-12-08 08:59 -0500
  Re: Converting recursive algorithm to an iterative version Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-12-08 06:30 -0800
    Re: Converting recursive algorithm to an iterative version Ania <anka.stepien@gmail.com> - 2011-12-08 08:25 -0800
      Re: Converting recursive algorithm to an iterative version Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-08 12:53 -0600
        Re: Converting recursive algorithm to an iterative version jgk@panix.com (Joe keane) - 2011-12-11 20:36 +0000
          Re: Converting recursive algorithm to an iterative version Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-11 15:37 -0600
            Re: Converting recursive algorithm to an iterative version Ania <anka.stepien@gmail.com> - 2011-12-11 14:26 -0800
  Re: Converting recursive algorithm to an iterative version Larry Evans <cppljevans@suddenlink.net> - 2011-12-08 11:58 -0600
    Re: Converting recursive algorithm to an iterative version Ania <anka.stepien@gmail.com> - 2011-12-08 11:41 -0800
  Re: Converting recursive algorithm to an iterative version Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 06:41 +0000
    Re: Converting recursive algorithm to an iterative version 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-09 12:51 -0800
      Re: Converting recursive algorithm to an iterative version Juha Nieminen <nospam@thanks.invalid> - 2011-12-10 09:54 +0000
        Re: Converting recursive algorithm to an iterative version 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-10 02:14 -0800
          Re: Converting recursive algorithm to an iterative version Juha Nieminen <nospam@thanks.invalid> - 2011-12-10 10:33 +0000
            Re: Converting recursive algorithm to an iterative version 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-10 02:41 -0800
              Re: Converting recursive algorithm to an iterative version 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-10 02:42 -0800
        Re: Converting recursive algorithm to an iterative version Tobias Müller <troplin@bluewin.ch> - 2011-12-10 11:56 +0000

csiph-web