Skip to content

Instantly share code, notes, and snippets.

@nerohoop
Created January 11, 2018 01:03
Show Gist options
  • Save nerohoop/6fce1cbad688e502c2110033bbbb3643 to your computer and use it in GitHub Desktop.
Save nerohoop/6fce1cbad688e502c2110033bbbb3643 to your computer and use it in GitHub Desktop.
bool BinaryHeap::isArrayHeap(int *arr, int size) {
for (int i=0; i<size/2; i++) {
if(2*i+1 < size && arr[2*i+1] > arr[i]) return false;
if(2*i+2 < size && arr[2*i+2] > arr[i]) return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment