`Heap` search, and more `Sequence` support

I added support for better underestimatedCount and contains implementations for the ascending and defending Heap views. This also required adding a search function for Heap directly.

I ended up implementing two versions of the prime search method, iterative and recursive. Those happen to correspond to breadth- and depth-first searching. Hopefully, someone can figure out how to benchmark everything and determine both the time- and space-complexities. And they need to be compared to simply running contains on the unordered view, which would be linear in time (and constant in space).

It's at Pull request 114 ("Better Sequence support for Heap")

1 Like

In a binary heap, contains can only be provided as an O(n) operation. What is your motivating use case for implementing it?

Terms of Service

Privacy Policy

Cookie Policy