We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f896082 commit 857d09eCopy full SHA for 857d09e
data_structures/heap/max_heap.py
@@ -12,7 +12,7 @@ class BinaryHeap:
12
13
>>> print(sample.get_list)
14
[10, 6]
15
- >>> print(sample.get_size)
+ >>> print(len(sample))
16
2
17
"""
18
@@ -64,8 +64,8 @@ def pop(self) -> int:
64
def get_list(self):
65
return self.__heap[1:]
66
67
- @property
68
- def get_size(self):
+ def __len__(self):
+ """ Length of the array """
69
return self.__size
70
71
@@ -82,7 +82,7 @@ def get_size(self):
82
print(sample.pop()) # 12
83
# get the list and size after operations
84
print(sample.get_list)
85
-print(sample.get_size)
+print(len(sample))
86
87
if __name__ == "__main__":
88
import doctest
0 commit comments