MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / clear

Method clear

data_structures/heap/skew_heap.py:220–231  ·  view source on GitHub ↗

Clear the heap. >>> sh = SkewHeap([3, 1, 3, 7]) >>> sh.clear() >>> sh.pop() Traceback (most recent call last): ... IndexError: Can't get top element for the empty heap.

(self)

Source from the content-addressed store, hash-verified

218 return self._root.value
219
220 def clear(self) -> None:
221 """
222 Clear the heap.
223
224 >>> sh = SkewHeap([3, 1, 3, 7])
225 >>> sh.clear()
226 >>> sh.pop()
227 Traceback (most recent call last):
228 ...
229 IndexError: Can't get top element for the empty heap.
230 """
231 self._root = None
232
233
234if __name__ == "__main__":

Callers 4

basicFunction · 0.45
rehashingMethod · 0.45
__make_key_listMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected