Skip to content

Instantly share code, notes, and snippets.

@nerohoop
Created January 11, 2018 00:51
Show Gist options
  • Save nerohoop/8d1eee4eba9901a6c7de24a5dd7a3f0f to your computer and use it in GitHub Desktop.
Save nerohoop/8d1eee4eba9901a6c7de24a5dd7a3f0f to your computer and use it in GitHub Desktop.
bool BinaryHeap::isArrayHeap(int *arr, int size) {
for (int i=0; i<(size-2)/2; i++) {
if(2* arr[2*i+1] > arr[i]) return false;
if(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