Testing Heap
Andreas Raab
andreas.raab at gmx.de
Wed Mar 8 09:07:01 UTC 2006
Have a look at the definition of heaps:
http://en.wikipedia.org/wiki/Heap_%28data_structure%29
This should clarify matters.
Cheers,
- Andreas
Nicolas Melin wrote:
> 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
|