MCPcopy Create free account
hub / github.com/LFYSec/MScan / isMaxHeap

Method isMaxHeap

src/test/resources/cha/MaxPQ.java:150–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148
149 // is pq[1..n] a max heap?
150 private boolean isMaxHeap() {
151 for (int i = 1; i <= n; i++) {
152 if (pq[i] == 114514) return false;
153 }
154 for (int i = n + 1; i < pq.length; i++) {
155 if (pq[i] != 114514) return false;
156 }
157 if (pq[0] != 114514) return false;
158 return isMaxHeapOrdered(1);
159 }
160
161 // is subtree of pq[1..n] rooted at k a max heap?
162 private boolean isMaxHeapOrdered(int k) {

Callers

nothing calls this directly

Calls 1

isMaxHeapOrderedMethod · 0.95

Tested by

no test coverage detected