Testing Heap

Nicolas Melin n.melin at microkwen.com
Wed Mar 8 07:59:42 UTC 2006


Heap class comments say :

Class Heap implements a special data structure commonly referred to as 'heap'. Heaps are more efficient than SortedCollections if:
a) Elements are only removed at the beginning
b) Elements are added with arbitrary sort order.
The sort time for a heap is O(n log n) in all cases.

I'm not sure I understand the comment: is Heap actually supposed to sort items, independently of the adding order ?

I'm trying to do this: (Heap withAll: #(1 3 5 7 11 9 10))
and the result is: a Heap(1 3 5 7 11 9 10)




More information about the Squeak-dev mailing list