You are here: Re: [PHP] who can do this without the recursion « PHP « IT news, forums, messages
Re: [PHP] who can do this without the recursion

Posted by "Richard Lynch" on 10/27/41 11:21

On Tue, July 5, 2005 3:48 am, Jochem Maas said:
> I have a function which recursively loops an assoc array in
> order to build an HTML string containing hidden <input> elements
> that repesent the key/values passed in the array ... I know this can
> be done without recursion but I'm having a brainfreeze, anyone care
> to share some tips on replacing the recursion with some kind of stack
> based solution (the idea being that I want to remove the overhead
> of the recursive calls to the function if possible ...

I don't recall the answer, but if you Google for "eliminate tail
recursion" or "convert tail recursion to iteration" you should find
Computer Science textbook examples galore.

You'd think having done a zillion of these in my Grad School days would
have made more of an impression...

Mostly it impressed me that recursion wasn't "cool" -- just another "tool"
and one that you only should pull out 1% of the time.

I have a hacksaw. I don't use it every meal.

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация