Good day, please help solve this problem:
Write a generic class called a pyramid (or heap) that stores elements of an arbitrary reference type. The elements are organized in the form of a binary tree, but are stored in an array of size 2 ^ h - 1, where h is the height of the tree (must be specified in the constructor). Initially, the array elements are equal to the zero reference and are considered empty. Items are added in the same way as in a binary search tree. The class must contain methods: Add - add an element with the specified value to the pyramid, • Exist - check whether the pyramid contains an element with the specified value.
How do I set the size? here is an example: https://habrahabr.ru/post/112222/ but there the size is different and I don’t really understand how and where it is set. Can you help ?
проверить, содержит ли пирамида элемент с указанным значениемthis is not a standard heap operation at all. So non-standard that I would start a separatemapfor it. And by the way, why bother if all the operations are to add and check if there is an element. This isset... - pavel