开发者

PHP Priority Queue Implementation

开发者 https://www.devze.com 2022-12-28 00:21 出处:网络
I just finished coding a complex job assignment application where a lot of the work was done开发者_StackOverflow社区 using priority queues. When I deployed, however, I discovered the web server ran PH

I just finished coding a complex job assignment application where a lot of the work was done开发者_StackOverflow社区 using priority queues. When I deployed, however, I discovered the web server ran PHP 5.2.

Has there been an implementation for PHP<5.3 that can server as a drop-in replacement for SPLPriorityQueue?


I don't know of anything that has the same interface.

But, I'd like to point out that if you don't need the performance characteristics of the heap implementation(small data sets probably don't), it wouldn't be much work to write your own using a regular php array.


I would have thought it would be quite simple to build one using SPLMaxHeap and a wrapper for each item?

C.

0

精彩评论

暂无评论...
验证码 换一张
取 消