php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51565 PHP Spl(Binary)Tree Structure
Submitted: 2010-04-15 23:35 UTC Modified: 2021-08-16 14:26 UTC
Votes:7
Avg. Score:4.7 ± 0.5
Reproduced:6 of 6 (100.0%)
Same Version:4 (66.7%)
Same OS:6 (100.0%)
From: clintonxa at gmail dot com Assigned: cmb (profile)
Status: Wont fix Package: SPL related
PHP Version: 5.3.2 OS: All
Private report: No CVE-ID: None
 [2010-04-15 23:35 UTC] clintonxa at gmail dot com
Description:
------------
SPL has so far included several very useful structures, and another basic one that we would benefit from is a tree structure.
It is possible to use an array for this now, but an SPL class would be beneficial.

Test script:
---------------
<?php

$btree = new SplBinaryTree(BTREE_SORT_NUMERIC);
$btree->add(4);
$btree->add(10);
$btree->add(2);

// Well, I'm not sure on how PHP devs would implement the tree's methods. 
// But a quick browse through any intro to OOP guide will give some ideas.

?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-10 18:18 UTC] salathe@php.net
-Package: Class/Object related +Package: SPL related
 [2011-12-13 02:57 UTC] morrison dot levi at gmail dot com
Honestly, heaps are just a representation of trees.  I know that particular 
benefits are associated with trees and others with heaps, but generally speaking 
you could probably just use a heap.
 [2014-03-27 15:20 UTC] levim@php.net
-Assigned To: +Assigned To: levim
 [2017-10-24 08:10 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: levim +Assigned To:
 [2020-04-22 07:09 UTC] alexinbeijing at gmail dot com
I suggest this request can be closed.
 [2021-08-16 14:26 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-08-16 14:26 UTC] cmb@php.net
> I suggest this request can be closed.

Right.  There is already SplHeap, and if that implementation is
not sufficiently performant for some cases, this needs to be
proven, and someone would need to pursue the RFC process[1].

[1] <https://wiki.php.net/rfc/howto>
 [2021-08-16 14:26 UTC] cmb@php.net
> I suggest this request can be closed.

Right.  There is already SplHeap, and if that implementation is
not sufficiently performant for some cases, this needs to be
proven, and someone would need to pursue the RFC process[1].

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 22:01:28 2024 UTC