Etienne Kneuss

home » news » SPL Datastructures updated

SPL Datastructures

The Standard PHP Library was recently completed by a couple of data structures, namely heaps and doubly linked lists. You can find more information about those on
php.net/spl.datastructures

Feeds available

You can read colder.ch directly from the rss/atom feeds:
rss general RSS (general)
rss php RSS (PHP)
atom general Atom (general)
atom php Atom (PHP)

New design : Clearblue

I've made a new skin using the same design with blue colors: Clearblue. Check it out

New website

As you can see, the website has changed completely. I've re-designed everything using different types of technology to give an overall improvement. Take a look in the news section for detailed information.

SPL Datastructures updated The 12th of May 2008 @ 18:34

Here is some news about data structures available in SPL:

  • There finally is documentation for SplDoublyLinkedList, SplStack and SplQueue.
  • "New" classes: SplHeap (abstract), SplMaxHeap, SplMinHeap and SplPriorityQueue, documentation of those classes is in progress.

Here is an example of a simple but task scheduler using SplPriorityQueue:

<?php $q = new SplPriorityQueue; $q->insert('a', 1); $q->insert('b', 4); // ... $q->insert('z', 2); foreach($q as $task) {     // .. process task ..     echo $task."\n";     // ... add new tasks ..     if ($task == 'b') {         $q->insert('c', 3);     } } /* Output:  * b  * c  * z  * a  */ ?>

This implementation is really efficient as the underlying data structure of SplPrioritiyQueue is a Heap, which allows insertions and extractions in O(log2(N)).

Comments

12.05.2008 #1 philip

Woohoo! :)

16.06.2008 #2 Dynom

Wow, neat indeed! I needed something like this a month back, but I'll keep this in mind for future projects. :-)

Add a comment

Username:

Spam Challenge: 1+19=?

Comment: