Re: PEAR Algorithms/Containers
| From: | Jochem Maas | Date: | Thu, 18 May 2006 12:12:08 +0000 |
| Subject: | Re: PEAR Algorithms/Containers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-236389@lists.php.net to get a copy of this message | ||
Andrew Brampton wrote:
Hi, In the past few weeks I've found the need for a hash table and a container that gives me O(log) search efficiency. Now I'm aware I can use associative arrays for my hash table, but I wanted to ensure efficiency. For my O(log) container I ended up using a sorted array, and a binary search (which I had to write). Now I thought common data structures, and algorithms, like these, and many others such as Binary Trees, Red/Black Trees and sorting algorithms and so on would be a useful addition to PHP, or more specifically PEAR, however I was unable to find any previous classes that provided these structures. So I figured I would make a set of containers and algorithms that could be used in a generic way , and hopefully put this code into PEAR. But before I start making nice PEAR code, I wanted to ask why nothing like this already exists? Is it because everyone has been to lazy until now, or is there a real reason that I'm missing that has made such structures pointless.sounds like a good idea. probably the reason it doesn't exist is because the entry level for making something worthwhile is high - and most people with such needs end up building something specific because it's easier. if you do go the PEAR route my suggestion would be to avoid all/any of the PEAR base classes - to save bloat and make the components more usable for people who don't want/need PEAR (or are not allowed to use it).
thanks for any comments/replies Andrew