From:             jeroen at jeroen-vandeven dot nl
Operating system: 
PHP version:      5.3.1
PHP Bug Type:     Feature/Change Request
Bug description:  Add a deleteMin() method to SplMaxHeap

Description:
------------
Add a deleteMin() method to SplMaxHeap (and/or a deleteMax() to 
SplMinHeap) to limit the size of the heap without taking off the top 
element.

Reproduce code:
---------------
$heap = new SplMaxHeap();
for ($i = 0; $i < 10000; $i++) {
$heap.insert($arr[$i])
if ($heap.count() > 100) {
$heap.deleteMin();
}
}

Expected result:
----------------
The example is pretty useless, it will add 100 elements to the heap and 
then add 9900 more, immediately removing each one.

This is useful in other situations where you may only be interested in 
the top 100 sorted elements of 10000 unsorted elements and don't want 
the heap to grow excessively large.

Actual result:
--------------
There is no deleteMin() method in SplMaxHeap

-- 
Edit bug report at http://bugs.php.net/?id=51141&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51141&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51141&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51141&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51141&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51141&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51141&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51141&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51141&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51141&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51141&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51141&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51141&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51141&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51141&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51141&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51141&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51141&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51141&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51141&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51141&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51141&r=mysqlcfg

Reply via email to